-
Notifications
You must be signed in to change notification settings - Fork 819
Open
Labels
bugSomething isn't workingSomething isn't workingfunctionsIssues tied to the functions categoryIssues tied to the functions categoryp3
Description
How did you install the Amplify CLI?
curl
If applicable, what version of Node.js are you using?
v18.18.2
Amplify CLI Version
12.7.1
What operating system are you using?
Mac
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
When deploying a Lambda Function in a Project based on Yarn 4, the command amplify push crashes as follows:
% amplify push
✔ Successfully pulled backend environment dev from the cloud.
Current Environment: dev
┌──────────┬───────────────┬───────────┬───────────────────┐
│ Category │ Resource name │ Operation │ Provider plugin │
├──────────┼───────────────┼───────────┼───────────────────┤
│ Function │ ay47b3e7244 │ Create │ awscloudformation │
└──────────┴───────────────┴───────────┴───────────────────┘
✔ Are you sure you want to continue? (Y/n) · yes
🛑 Packaging lambda function failed with the error
Command failed with exit code 1: yarn install --production
➤ YN0050: The --production option is deprecated on 'install'; use 'yarn workspaces focus' instead
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/
Session Identifier: 7282a548-35f7-42e4-b29d-19df116b78e0Which is caused most likely through this code in amplify-cli-core/src/utils/packageManager.ts:
class YarnPackageManager implements PackageManager {
readonly packageManager: PackageManagerType = 'yarn';
readonly displayValue = 'Yarn';
readonly executable = 'yarn';
readonly lockFile = 'yarn.lock';
version?: SemVer;
getRunScriptArgs = (scriptName: string) => [scriptName];
getInstallArgs = (buildType = BuildType.PROD) => {
const useYarnModern = this.version?.major && this.version?.major > 1;
return (useYarnModern ? ['install'] : ['--no-bin-links']).concat(buildType === 'PROD' ? ['--production'] : []);
};
}It should be changed to invoke yarn workspaces focus
Expected behavior
Deploy lambdas correctly using Yarn 4
Reproduction steps
% mkdir amplify-with-yarn4
% cd amplify-with-yarn4
% corepack enable
% yarn init -2
% amplify init # just init an amplify project
% amplify add function # e.g. Hello World Lambda
% amplify pushProject Identifier
Session Identifier: 7282a548-35f7-42e4-b29d-19df116b78e0
Log output
Details
# Put your logs below this line
2023-10-28T12:01:15.566Z|info : amplify push core
2023-10-28T12:01:15.641Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-10-28T12:01:16.727Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["MY_CREDENTIALS"])
2023-10-28T12:01:16.729Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"region":"eu-central-1"}])
2023-10-28T12:01:16.729Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileCredentials(["MY_CREDENTIALS"])
2023-10-28T12:01:16.736Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
2023-10-28T12:01:16.737Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]y4-[***]ev-[***]616-[***]ment"}])
2023-10-28T12:01:16.930Z|info : amplify-provider-awscloudformation.initialize-env.run.cfn.updateamplifyMetaFileWithStackOutputs([{"StackName":"[***]ify-[***]y4-[***]ev-[***]616"}])
2023-10-28T12:01:16.933Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["MY_CREDENTIALS"])
2023-10-28T12:01:16.934Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"region":"eu-central-1"}])
2023-10-28T12:01:16.934Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileCredentials(["MY_CREDENTIALS"])
2023-10-28T12:01:16.940Z|info : amplify-provider-awscloudformation.aws-cfn.updateamplifyMetaFileWithStackOutputs.cfn.listStackResources([{"StackName":"[***]ify-[***]y4-[***]ev-[***]616"}])
2023-10-28T12:01:17.111Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]y4-[***]ev-[***]616"}])
2023-10-28T12:01:17.256Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]y4-[***]ev-[***]616-[***]ment"}])
2023-10-28T12:01:17.403Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["MY_CREDENTIALS"])
2023-10-28T12:01:17.404Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"region":"eu-central-1"}])
2023-10-28T12:01:17.404Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileCredentials(["MY_CREDENTIALS"])
2023-10-28T12:01:18.688Z|error : Packaging lambda function failed with the error
Command failed with exit code 1: yarn install --production
➤ YN0050: The --production option is deprecated on 'install'; use 'yarn workspaces focus' instead
PackagingLambdaFunctionError: Packaging lambda function failed with the error
Command failed with exit code 1: yarn install --production
➤ YN0050: The --production option is deprecated on 'install'; use 'yarn workspaces focus' instead
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.
codenimble, libinvarghese and yusukegotojgo80jgo80 and chrisl777
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfunctionsIssues tied to the functions categoryIssues tied to the functions categoryp3