amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

Build backend failed - Error: Command failed with ENOMEM: yarn --version

Open kouz75 opened this issue 2 years ago • 24 comments

How did you install the Amplify CLI?

yarn

If applicable, what version of Node.js are you using?

20.x

Amplify CLI Version

12.10.3

What operating system are you using?

Amazon linux 2023

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes made

Describe the bug

build the backend on Amplify continous deployment failed

amplifyPush --simple return the error :

UPDATE_COMPLETE xxxx AWS::CloudFormation::Stack Sat Mar 30 2024 09:33:33 GMT+0000 (Coordinated Universal Time) 2024-03-30T09:33:56.664Z [INFO]:  2024-03-30T09:33:57.460Z [WARNING]: ✖ There was an error initializing your environment. 2024-03-30T09:33:57.461Z [INFO]: 🛑 Received error [Error: Command failed with ENOMEM: yarn --version spawn ENOMEM] running command [yarn --version] 2024-03-30T09:33:57.462Z [INFO]: Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Cloudformation stack is update without any error.

I wasn't able to reproduce the error on other Amplify project but I don't understand why there is this error.

Expected behavior

project should deploy

Reproduction steps

deploy a branch via amplify console. backend deployement crash.

Project Identifier

Project Identifier: ed57bb8a46476511162afa8497d78147

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • [X] I have removed any sensitive information from my code snippets and submission.

kouz75 avatar Mar 30 '24 09:03 kouz75

I got this too, but managed to work around it by fixing the Amplify CLI version to 12.10.1 in Build settings.

duckbytes avatar Mar 30 '24 16:03 duckbytes

everything is building correctly today 🤷

kouz75 avatar Mar 31 '24 16:03 kouz75

I got this too, but managed to work around it by fixing the Amplify CLI version to 12.10.1 in Build settings.

Sadly encountered this too today. Rolling back to 12.10.1 worked, after rolling back to 12.10.2 didn't (current LATEST is 12.10.3). Funny thing is my build worked on 12.10.2 (I'm assuming) - 12 days ago, using LATEST, which was after 12.10.2 was released.

DuncanHouston avatar Mar 31 '24 17:03 DuncanHouston

@DuncanHouston @kouz75 @duckbytes could you provide is the appId, region and failed build number to dive into the logs?

ykethan avatar Apr 01 '24 14:04 ykethan

@ykethan (sorry for all the edits...) I have the same issue. I tried backend: 12.10.3 w/ frontend: nvm use 18. Build 230 on qranswers (dxm5h4ts57z1x), us-east-1. backend failed. 2024-04-04T00:00:45.231Z [INFO]: 🛑 Received error [Error: Command failed with ENOMEM: yarn --version spawn ENOMEM] running command [yarn --version]

rolled back to backend: 12.10.1 and frontend: nvm use 18 Build 231 - backend failed with socket timeout 2024-04-04T00:18:10.709Z [INFO]: 🛑 Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.

rolled back to backend: 12.10.1 and frontend: nvm use 16, Build 232 - backend built fine, frontend built fine

231 seemed odd, so ... tried again - backend: 12.10.1 and frontend: nvm use 18, Build 233 - backend built fine, frontend built fine. So, the 'socket error' seems transient and not repeatable for Build 231 - since 233 and 231 were identical.

Build 230 has the issue with 12.10.3.

Let me know if you need further info to track this down

ggcespia avatar Apr 04 '24 00:04 ggcespia

@ykethan

dlkp8fs0a5r7s eu-west-1 Build 19

There are more than one backend. The name of the one that failed is jobye.

duckbytes avatar Apr 04 '24 00:04 duckbytes

Hi Kethan

Thanks for looking into.

Details: App ID: d2fvsjngy3mjj6 Region: EU-WEST-1

This was on the develop branch

Build numbers: Build #675 - 19 March ’24 - CLI v12.10.1 - SUCCESS Build #676 - 31 March ’24 - CLI v12.10.3 - FAIL Build #677 - 31 March ’24 - CLI v12.10.3 - FAIL Build #678 - 31 March ’24 - CLI v12.10.2 - FAIL Build #679 - 31 March ’24 - CLI v12.10.1 - SUCCESS

Build #675 & #676 (perhaps #677), was choosing latest CLI automatically, thereafter manual selection

Thanks Duncan

On 01 Apr 2024, at 16:44, Kethan sai @.***> wrote:

@DuncanHouston https://github.com/DuncanHouston @kouz75 https://github.com/kouz75 @duckbytes https://github.com/duckbytes could you provide is the appId, region and failed build number to dive into the logs?

— Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-cli/issues/13681#issuecomment-2029869701, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFUUMQUNBGXVTZ65HPGD5LY3FXDDAVCNFSM6AAAAABFPNSW2OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRZHA3DSNZQGE. You are receiving this because you were mentioned.

DuncanHouston avatar Apr 04 '24 06:04 DuncanHouston

hi,

sorry for the delay. On my side, everything is working correctly now (I have switch back to default setting (use default nodejs version and default amplify version)).

kouz75 avatar Apr 04 '24 10:04 kouz75

Hey folks, could you add AMPLIFY_ENABLE_DEBUG_OUTPUT as true, retry with the latest Amplify CLI version and provide us the stack trace? Could you provide us information the build image being used? Do you observe any errors on CloudFormation or on a local push?

ykethan avatar Apr 04 '24 17:04 ykethan

@ykethan, Sadly encountered this too from 3 days ago, also I'm running that you said.

Build image: Amazon Linux:2 image Amplify CLI: latest AMPLIFY_ENABLE_DEBUG_OUTPUT: true

I got this track trace:

2024-04-04T20:05:52.356Z [INFO]:  2024-04-04T20:05:52.853Z [WARNING]: ✖ There was an error initializing your environment. 2024-04-04T20:05:52.855Z [INFO]: 🛑 Received error [Error: Command failed with ENOMEM: yarn --version spawn ENOMEM] running command [yarn --version] 2024-04-04T20:05:52.855Z [INFO]: Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/ ShellCommandExecutionError: Received error [Error: Command failed with ENOMEM: yarn --version spawn ENOMEM] running command [yarn --version] at execWithOutputAsString (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-cli-core/lib/utils/shell-utils.js:38:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async getYarnPackageManager (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-cli-core/lib/utils/packageManager.js:131:36) at async getLayerGlobs (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-function/lib/provider-utils/awscloudformation/utils/layerHelpers.js:305:36) at async hashLayerVersion (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-function/lib/provider-utils/awscloudformation/utils/layerHelpers.js:345:32) at async hashLayerResource (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-function/lib/provider-utils/awscloudformation/utils/layerHelpers.js:275:12) at async isBackendDirModifiedSinceLastPush (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:408:26) at async /snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:266:45 at async asyncForEach (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:454:9) at async /snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:255:9 at async asyncForEach (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:454:9) at async getResourcesToBeUpdated (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:253:5) at async AmplifyToolkit.getResourceStatus (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:122:32) at async getAuthResourceName (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-auth/lib/utils/getAuthResourceName.js:5:30) at async updateAppClientWithGeneratedSecret (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-auth/lib/provider-utils/awscloudformation/utils/generate-cognito-app-client-secret.js:13:38) at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/push-resources.js:274:5)

djom202 avatar Apr 04 '24 20:04 djom202

Sorry, where do I put the AMPLIFY_ENABLE_DEBUG_OUTPUT true setting. My yaml file looks like this for the backend. version: 1.4 backend: phases: preBuild: commands: - npm i -g @aws-amplify/[email protected] build: commands: - '# Execute Amplify CLI with helper script' - amplifyPush --simple

I have continuous deployment setup from GitHub.

ggcespia avatar Apr 04 '24 21:04 ggcespia

Sorry, where do I put the AMPLIFY_ENABLE_DEBUG_OUTPUT true setting. My yaml file looks like this for the backend. version: 1.4 backend: phases: preBuild: commands: - npm i -g @aws-amplify/[email protected] build: commands: - '# Execute Amplify CLI with helper script' - amplifyPush --simple

I have continuous deployment setup from GitHub.

Into App settings > Environment variables > Manage Variables > Add Variable

djom202 avatar Apr 04 '24 21:04 djom202

@ykethan Build image: Amazon Linux:2 image Amplify CLI: 12.10.3 AMPLIFY_ENABLE_DEBUG_OUTPUT: true Build 234 dxm5h4ts57z1x The local push works fine.

same issue as above: 2024-04-04T23:38:13.541Z [INFO]:  2024-04-04T23:38:14.648Z [WARNING]: ✖ There was an error initializing your environment. 2024-04-04T23:38:14.649Z [INFO]: 🛑 Received error [Error: Command failed with ENOMEM: yarn --version spawn ENOMEM] running command [yarn --version] 2024-04-04T23:38:14.650Z [INFO]: Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/ ShellCommandExecutionError: Received error [Error: Command failed with ENOMEM: yarn --version spawn ENOMEM] running command [yarn --version] at execWithOutputAsString (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-cli-core/lib/utils/shell-utils.js:38:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async getYarnPackageManager (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-cli-core/lib/utils/packageManager.js:131:36) at async getLayerGlobs (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-function/lib/provider-utils/awscloudformation/utils/layerHelpers.js:305:36) at async hashLayerVersion (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-function/lib/provider-utils/awscloudformation/utils/layerHelpers.js:345:32) at async hashLayerResource (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-function/lib/provider-utils/awscloudformation/utils/layerHelpers.js:275:12) at async isBackendDirModifiedSinceLastPush (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:408:26) at async /snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:266:45 at async asyncForEach (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:454:9) at async /snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:255:9 at async asyncForEach (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:454:9) at async getResourcesToBeUpdated (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:253:5) at async AmplifyToolkit.getResourceStatus (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:122:32) at async getAuthResourceName (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-auth/lib/utils/getAuthResourceName.js:5:30) at async updateAppClientWithGeneratedSecret (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-auth/lib/provider-utils/awscloudformation/utils/generate-cognito-app-client-secret.js:13:38) at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/push-resources.js:274:5) 2024-04-04T23:38:14.665Z [INFO]: 2024-04-04T23:38:14.666Z [INFO]: Session Identifier: 09d4832f-0780-40ef-9b30-93aa075052b9

ggcespia avatar Apr 04 '24 23:04 ggcespia

Hey folks, thank you for providing the information. The Amplify team is currently investigating this issue. We will provide an update here as soon as we get some additional information. Marking as bug for further investigation.

ykethan avatar Apr 05 '24 14:04 ykethan

We have what we believe to be the proper fix for the issue (https://github.com/aws-amplify/amplify-category-api/pull/2426). We are having trouble reproducing the issue to properly test the fix. If anyone can provide the reproduction steps from a new project that would be very useful to us.

dpilch avatar Apr 05 '24 20:04 dpilch

We have created a tagged release with the fix mentioned above. If anyone can use this to confirm this resolves the issue that would be greatly appreciated. However, please do not use this version in a production environment. This tagged release has not gone through the normal battery of tests. @aws-amplify/[email protected].

dpilch avatar Apr 08 '24 17:04 dpilch

This failed for me Build 237

2024-04-08T18:19:33.787Z [INFO]: # Executing command: npm i -g @@.*** ... 2024-04-08T18:30:46.662Z [WARNING]: ✖ There was an error initializing your environment. 2024-04-08T18:30:46.663Z [INFO]: 🛑 Received error [Error: Command failed with ENOMEM: yarn --version spawn ENOMEM] running command [yarn --version] 2024-04-08T18:30:46.663Z [INFO]: Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/ ShellCommandExecutionError: Received error [Error: Command failed with ENOMEM: yarn --version spawn ENOMEM] running command [yarn --version] at execWithOutputAsString @./amplify-cli-core/lib/utils/shell-utils.js:38:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async getYarnPackageManager @./amplify-cli-core/lib/utils/packageManager.js:139:36) at async getLayerGlobs @./amplify-category-function/lib/provider-utils/awscloudformation/utils/layerHelpers.js:305:36) at async hashLayerVersion @./amplify-category-function/lib/provider-utils/awscloudformation/utils/layerHelpers.js:345:32) at async hashLayerResource @./amplify-category-function/lib/provider-utils/awscloudformation/utils/layerHelpers.js:275:12) at async isBackendDirModifiedSinceLastPush @./cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:408:26) at async @./cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:266:45 at async asyncForEach @./cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:454:9) at async @./cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:255:9 at async asyncForEach @./cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:454:9) at async getResourcesToBeUpdated @./cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:253:5) at async AmplifyToolkit.getResourceStatus @./cli-internal/lib/extensions/amplify-helpers/resource-status-data.js:122:32) at async getAuthResourceName @./amplify-category-auth/lib/utils/getAuthResourceName.js:5:30) at async updateAppClientWithGeneratedSecret @./amplify-category-auth/lib/provider-utils/awscloudformation/utils/generate-cognito-app-client-secret.js:13:38) at async Object.run @.***/amplify-provider-awscloudformation/lib/push-resources.js:274:5)

On Mon, Apr 8, 2024 at 10:51 AM Dane Pilcher @.***> wrote:

We have created a tagged release with the fix mentioned above. If anyone can use this to confirm this resolves the issue that would be greatly appreciated. However, please do not use this version in a production environment. This tagged release has not gone through the normal battery of tests. @@.***

— Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-cli/issues/13681#issuecomment-2043329823, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABU6X5ZH7WATBLFPE3KA6TY4LKLPAVCNFSM6AAAAABFPNSW2OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBTGMZDSOBSGM . You are receiving this because you commented.Message ID: @.***>

--

Greg Carpenter

CEO/Founder | Troparé Inc. https://www.tropare.com/

p: (949) 310-2765 | e: @.***

This message contains proprietary information from Troparé which may be confidential. If you are not an intended recipient, please refrain from reading, copying, distributing, or using this information and note that such actions are prohibited. If you have received this transmission in error, please notify by e-mail @.** @.**> and delete this message. Troparé is a registered trademark of Troparé Inc. All rights reserved.

ggcespia avatar Apr 08 '24 19:04 ggcespia

@ggcespia, thank you for testing the tagged release. We will continue to investigate the root cause of this issue.

dpilch avatar Apr 08 '24 20:04 dpilch

I got this too, but managed to work around it by fixing the Amplify CLI version to 12.10.1 in Build settings.

Sadly encountered this too today. Rolling back to 12.10.1 worked, after rolling back to 12.10.2 didn't (current LATEST is 12.10.3). Funny thing is my build worked on 12.10.2 (I'm assuming) - 12 days ago, using LATEST, which was after 12.10.2 was released.

Hi, Confirming successful build execution using Amplify CLI version 12.10.1 as previously mentioned.

djom202 avatar Apr 10 '24 16:04 djom202

The fix for this was shipped in version 12.11.1

sobolk avatar Apr 18 '24 03:04 sobolk