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

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:

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

About this issue

  • Original URL
  • State: closed
  • Created 3 months ago
  • Reactions: 1
  • Comments: 21 (7 by maintainers)

Most upvoted comments

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

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.

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.