amplify-cli: Amplify push fails with yarn.cmd --no-bin-links
Before opening, please confirm:
- I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- 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.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
16.13.1
Amplify CLI Version
9.1.0
What operating system are you using?
Windows 10
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No changes
Amplify Categories
function, api
Amplify Commands
add, push
Describe the bug
amplify push fails with the following error:
Packaging lambda function failed with the error Command failed with exit code 1: yarn.cmd --no-bin-links --production Unknown Syntax Error: Unsupported option name ("--no-bin-links").
Expected behavior
The app would be pushed and provisioned on AWS.
Reproduction steps
- Install amplify cli
mkdir amplifytestcd amplifytestamplify initamplify add apiamplify push
GraphQL schema(s)
# Put schemas below this line
Project Identifier
fd02a5ba7642c194209c6417a178457e
Log output
# Put your logs below this line
2022-07-27T19:25:46.433Z|info : amplify push core
2022-07-27T19:25:46.479Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2022-07-27T19:25:47.593Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["prodregmiddleware"])
2022-07-27T19:25:47.594Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"region":"us-west-2"}])
2022-07-27T19:25:47.594Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileCredentials(["prodregmiddleware"])
2022-07-27T19:25:47.601Z|info : amplify-provider-awscloudformation.aws-s3.deleteDirectory.s3.getAllObjectVersions([{"BucketName":"[***]ify-[***]ytest-[***]ev-[***]226-[***]ment"}])
2022-07-27T19:25:47.601Z|info : amplify-provider-awscloudformation.aws-s3.getAllObjectKey.s3.listObjectVersions([{"Bucket":"[***]ify-[***]ytest-[***]ev-[***]226-[***]ment","Prefix":"hooks/"}])
2022-07-27T19:25:48.258Z|info : amplify-provider-awscloudformation.aws-s3.deleteAllObjects.s3.deleteObjects (0 of 1)([{"Bucket":"[***]ify-[***]ytest-[***]ev-[***]226-[***]ment"}])
2022-07-27T19:25:48.850Z|info : amplify-provider-awscloudformation.aws-s3.uploadFile.s3.putObject([{"Body":{"_readableState":{"objectMode":false,"highWaterMark":65536,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":[],"flowing":null,"ended":false,"endEmitted":false,"reading":false,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"errorEmitted":false,"emitClose":true,"autoDestroy":false,"destroyed":false,"errored":null,"closed":false,"closeEmitted":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"dataEmitted":false,"decoder":null,"encoding":null},"_events":{},"_eventsCount":1,"path":"C:\\projects\\amplifytest\\amplify\\hooks\\post-push.sh.sample","fd":null,"flags":"r","mode":438,"end":null,"autoClose":true,"bytesRead":0,"closed":false},"Key":"[***]ks/[***]st-[***]sample","Bucket":"[***]ify-[***]ytest-[***]ev-[***]226-[***]ment"}])
2022-07-27T19:25:49.692Z|info : amplify-provider-awscloudformation.aws-s3.uploadFile.s3.putObject([{"Body":{"_readableState":{"objectMode":false,"highWaterMark":65536,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":[],"flowing":null,"ended":false,"endEmitted":false,"reading":false,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"errorEmitted":false,"emitClose":true,"autoDestroy":false,"destroyed":false,"errored":null,"closed":false,"closeEmitted":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"dataEmitted":false,"decoder":null,"encoding":null},"_events":{},"_eventsCount":1,"path":"C:\\projects\\amplifytest\\amplify\\hooks\\pre-push.js.sample","fd":null,"flags":"r","mode":438,"end":null,"autoClose":true,"bytesRead":0,"closed":false},"Key":"[***]ks/[***]re-[***]sample","Bucket":"[***]ify-[***]ytest-[***]ev-[***]226-[***]ment"}])
2022-07-27T19:25:50.352Z|info : amplify-provider-awscloudformation.aws-s3.uploadFile.s3.putObject([{"Body":{"_readableState":{"objectMode":false,"highWaterMark":65536,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":[],"flowing":null,"ended":false,"endEmitted":false,"reading":false,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"errorEmitted":false,"emitClose":true,"autoDestroy":false,"destroyed":false,"errored":null,"closed":false,"closeEmitted":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"dataEmitted":false,"decoder":null,"encoding":null},"_events":{},"_eventsCount":1,"path":"C:\\projects\\amplifytest\\amplify\\hooks\\README.md","fd":null,"flags":"r","mode":438,"end":null,"autoClose":true,"bytesRead":0,"closed":false},"Key":"[***]ks/[***]E.md","Bucket":"[***]ify-[***]ytest-[***]ev-[***]226-[***]ment"}])
2022-07-27T19:25:50.983Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["prodregmiddleware"])
2022-07-27T19:25:50.984Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"region":"us-west-2"}])
2022-07-27T19:25:50.984Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileCredentials(["prodregmiddleware"])
2022-07-27T19:25:50.988Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
2022-07-27T19:25:50.994Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]ytest-[***]ev-[***]226-[***]ment"}])
2022-07-27T19:25:51.737Z|info : amplify-provider-awscloudformation.initialize-env.run.cfn.updateamplifyMetaFileWithStackOutputs([{"StackName":"[***]ify-[***]ytest-[***]ev-[***]226"}])
2022-07-27T19:25:51.741Z|info : amplify-provider-awscloudformation.aws-cfn.updateamplifyMetaFileWithStackOutputs.cfn.listStackResources([{"StackName":"[***]ify-[***]ytest-[***]ev-[***]226"}])
2022-07-27T19:25:52.353Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]ytest-[***]ev-[***]226"}])
2022-07-27T19:25:52.922Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]ytest-[***]ev-[***]226-[***]ment"}])
2022-07-27T19:26:27.675Z|error : amplify-provider-awscloudformation.push-resources.run([{"resourcesToBeCreated":[{"build":true,"providerPlugin":"[***]rmation","service":"Lambda","resourceName":"[***]32649027","category":"function"},{"service":"API Gateway","providerPlugin":"[***]rmation","dependsOn":[{"category":"function","resourceName":"[***]32649027","attributes":["Name","Arn"]}],"resourceName":"[***]c6663","category":"api"}],"resourcesToBeUpdated":[],"resourcesToBeSynced":[],"resourcesToBeDeleted":[],"rootStackUpdated":false,"tagsUpdated":false,"allResources":[{"build":true,"providerPlugin":"[***]rmation","service":"Lambda","resourceName":"[***]32649027","category":"function"},{"service":"API Gateway","providerPlugin":"[***]rmation","dependsOn":[{"category":"function","resourceName":"[***]32649027","attributes":["Name","Arn"]}],"resourceName":"[***]c6663","category":"api"}]}])
Error: Packaging lambda function failed with the error
Command failed with exit code 1: yarn.cmd --no-bin-links --production
[31m[1mUnknown Syntax Error[22m[39m: Unsupported option name ("--no-bin-links").
$ yarn cache clean [--mirror] [--all]
$ yarn cache clean [--mirror] [--all]
$ yarn config get [--json] [--no-redacted] <name>
$ yarn config set [--json] [-H,--home] <name> <value>
$ yarn config unset [-H,--home] <name>
$ yarn set resolution [-s,--save] <descriptor> <resolution>
$ yarn set version from sources [--path #0] [--repository #0] [--branch #0] [--plugin #0] [--no-minify] [-f,--force] [--skip-plugins]
$ yarn set version [--only-if-needed] <version>
$ yarn workspaces list [--since] [-R,--recursive] [-v,--verbose] [--json]
$ yarn --clipanion=definitions
$ yarn help
$ yarn help
$ yarn help
$ yarn <leadingArgument> ...
$ yarn -v
$ yarn -v
$ yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] [--mode #0] ...
$ yarn bin [-v,--verbose] [--json] [name]
$ yarn config [-v,--verbose] [--why] [--json]
$ yarn dedupe [-s,--strategy #0] [-c,--check] [--json] [--mode #0] ...
$ yarn exec <commandName> ...
$ yarn explain peer-requirements [hash]
$ yarn explain [--json] [code]
$ yarn info [-A,--all] [-R,--recursive] [-X,--extra #0] [--cache] [--dependents] [--manifest] [--name-only] [--virtuals] [--json] ...
$ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]
$ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]
$ yarn link [-A,--all] [-p,--private] [-r,--relative] <destination>
$ yarn unlink [-A,--all] ...
$ yarn node ...
$ yarn plugin import from sources [--path #0] [--repository #0] [--branch #0] [--no-minify] [-f,--force] <name>
$ yarn plugin import <name>
$ yarn plugin remove <name>
$ yarn plugin list [--json]
$ yarn plugin runtime [--json]
$ yarn rebuild ...
$ yarn remove [-A,--all] [--mode #0] ...
$ yarn run
$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
$ yarn up [-i,--interactive] [-E,--exact] [-T,--tilde] [-C,--caret] [-R,--recursive] [--mode #0] ...
$ yarn why [-R,--recursive] [--json] [--peers] <package>
$ yarn workspace <workspaceName> <commandName> ...
$ yarn create [-p,--package #0] [-q,--quiet] <command> ...
$ yarn dlx [-p,--package #0] [-q,--quiet] <command> ...
$ yarn init [-p,--private] [-w,--workspace] [-i,--install]
$ yarn npm audit [-A,--all] [-R,--recursive] [--environment #0] [--json] [--severity #0]
$ yarn npm info [-f,--fields #0] [--json] ...
$ yarn npm login [-s,--scope #0] [--publish]
$ yarn npm logout [-s,--scope #0] [--publish] [-A,--all]
$ yarn npm publish [--access #0] [--tag #0] [--tolerate-republish] [--otp #0]
$ yarn npm tag add <package> <tag>
$ yarn npm tag list [--json] [package]
$ yarn npm tag remove <package> <tag>
$ yarn npm whoami [-s,--scope #0] [--publish]
$ yarn pack [--install-if-needed] [-n,--dry-run] [--json] [-o,--out #0]
$ yarn patch-commit [-s,--save] <patchFolder>
$ yarn patch [--json] <package>
$ yarn unplug [-A,--all] [-R,--recursive] [--json] ...
2022-07-27T19:27:32.369Z|info : amplify version core {"version":true,"yes":false}
2022-07-27T19:38:20.837Z|info : amplify diagnose core {"send-report":true,"yes":false}
2022-07-27T19:38:20.884Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 16 (1 by maintainers)
@PeteDuncanson I was able to identify the issue. Creating a new function using windows with Amplify cli adds
.cmdto build command in theamplify.statefile. The file is present inbackend/function/<function-name>/Removing the.cmdand committing the changes seems to fix the build error in the console.Workaround that likely should be addressed in the documentation:
.\amplify\backend\function\<projectname>\srcnpm iamplify pushThis is due to the new yarn version not being supported by amplify.
I got it to work by temporarily switching to the old yarn with
yarn set version classicand then switch back toyarn set version berryafter pushing with amplify.I ran into this too following the Amplify example under Custom business logic (Lambda function) with Amplify CLI v
9.2.1.Thanks for adding the comment about running
npm -iin the<proj>/amplify/backend/function/<funcName>directory). I guess it’s obvious one should do that at some point since each function has its own package.json. But probably most people would expectamplify pushto do it if a function has been added or modified. In any case, the error is quite confusing if you forget. When you search for it online, not much shows up. It would be great if the Amplify CLI could show a better error.@8maxxam8 I gave up on Amplify a while ago and was able to do in one morning what I had never been able to reliably accomplish with Amplify even after years.
Is this also working on mac? As I am unable to find the amplify.state file. Even if I fade in the hidden files with “CMD + .” the amplify.state is not showing up.
That might have something to do with it, thanks for the information. Our engineers are investigating the problem.
Started getting this last few days but with the CI. Manually
amplify pushworks but building on the server via a git push doesn’t.Tried the above fix but its still complaining. Not sure what to do to unstick it?