Amplifylocal init error

I tried to run amplifylocal init.
but it said this error.

➜  shunsuke_shoppify_app git:(main) ✗ amplifylocal init
Note: It is recommended to run this command from the root of your app directory
? Enter a name for the project shunsukeshoppifyapp
The following configuration will be applied:

Project information
| Name: shunsukeshoppifyapp
| Environment: dev
| Default editor: Visual Studio Code
| App type: javascript
| Javascript framework: none
| Source Directory Path: src
| Distribution Directory Path: dist
| Build Command: npm run-script build
| Start Command: npm run-script start

? Initialize the project with the above configuration? Yes
Using default provider  awscloudformation
? Select the authentication method you want to use: AWS access keys
? accessKeyId:  ********************
? secretAccessKey:  ****************************************
? region:  ap-northeast-1
Invalid configuration settings!

are there any solutions?

Hi @shunsuke.h,

Please use the newer version localstack/amplify-js-local: Simple wrapper script to allow using the Amplify JS SDK with LocalStack (github.com)

I think my version is latest.
which version should I use?

➜  shunsuke_shoppify_app git:(main) ✗ amplifylocal version
12.3.0
➜  shunsuke_shoppify_app git:(main) ✗ amplify version
12.3.0
➜  shunsuke_shoppify_app git:(main) ✗ amplifylocal init
Note: It is recommended to run this command from the root of your app directory
? Do you want to use an existing environment? No
? Enter a name for the environment stg
Using default provider  awscloudformation
? Select the authentication method you want to use: AWS profile

For more information on AWS Profiles, see:
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

? Please choose the profile you want to use localstack
Adding backend environment stg to AWS Amplify app: f92dd25a

Deploying resources into stg environment. This will take a few minutes. ⠙
Deploying root stack shunsukeshoppifyapp [ ---------------------------------------- ] 0/4

An error occurred when creating the CloudFormation stack
🛑 The security token included in the request is invalid.

Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include th
Deploying resources into stg environment. This will take a few minutes. ⠹
Deploying root stack shunsukeshoppifyapp [ ---------------------------------------- ] 0/4

Session Identifier: 52e0b24c-cd7e-4446-b024-768f83eae5ce
➜  shunsuke_shoppify_app git:(main) ✗ cat ~/.aws/credentials
[default]
aws_access_key_id = fake
aws_secret_access_key = fake
[localstack]
aws_access_key_id = fake
aws_secret_access_key = fake
➜  shunsuke_shoppify_app git:(main) ✗ cat ~/.aws/config
[default]
region = ap-northeast-1
[profile localstack]
region = ap-northeast-1

Hi @shunsuke.h,

I apologize, I have sent you a wrong link. I meant the new version of amplify plugin provided by LocalStack localstack/amplify-localstack: Amplify Plugin to deploy resources into Localstack (github.com)

Changed a little bit.
but still happend error…

➜  shunsuke_shoppify_app git:(main) ✗ amplify init --use-localstack true
Info:	 Patching AWS Amplify libs
Error:		LocalStack plugin unable to patch Configuration Manager
Error:		LocalStack Plugin unable to patch CopyBatch Utility
Error:		Localstack Plugin unable to patch WriteJsonFile Utility
Note: It is recommended to run this command from the root of your app directory
? Do you want to use an existing environment? No
? Enter a name for the environment stg
Using default provider  awscloudformation
? Select the authentication method you want to use: AWS profile

For more information on AWS Profiles, see:
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

? Please choose the profile you want to use localstack
🛑 The security token included in the request is invalid.

Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the project identifier from: 'amplify diagnose --send-report'
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: 5caafb1e-b701-4185-8bba-3c3fa13135e0

Thank you for reporting this. I confirmed that in the lates version of amplify cli they updated the paths where the patches are applied. There is a fix in progress

It proceed a little bit.
But it produced another error.

➜  shunsuke_shoppify_app git:(main) ✗ amplify init --use-localstack true
Info:	 Patching AWS Amplify libs
Note: It is recommended to run this command from the root of your app directory
? Do you want to use an existing environment? No
? Enter a name for the environment localdev
Using default provider  awscloudformation
? Select the authentication method you want to use: AWS profile

For more information on AWS Profiles, see:
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

? Please choose the profile you want to use localstack
Adding backend environment localdev to AWS Amplify app: a1fdd09b

Deployment completed.
Deployed root stack shunsukeshoppifyapp [ ======================================== ] 4/4
	amplify-shunsukeshoppifyapp-l… AWS::CloudFormation::Stack     CREATE_COMPLETE
	DeploymentBucket               AWS::CloudFormation::Stack     CREATE_COMPLETE
	AuthRole                       AWS::CloudFormation::Stack     CREATE_COMPLETE
	UnauthRole                     AWS::CloudFormation::Stack     CREATE_COMPLETE

Deployment state saved successfully.
✔ Initialized provider successfully.
✅ Initialized your environment successfully.

Your project has been successfully initialized and connected to the cloud!

Some next steps:
"amplify status" will show you what you've added already and if it's locally configured or deployed
"amplify add <category>" will allow you to add features like user login or a backend API
"amplify push" will build all your local backend resources and provision it in the cloud
"amplify console" to open the Amplify Console and view your project status
"amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud

Pro tip:
Try "amplify add api" to create a backend API and then "amplify push" to deploy everything

🛑 Cannot find module '/Users/shunsuke.h/.nodenv/versions/16.13.1/lib/node_modules/amplify-localstack/event-handlers/handle-PostEnvAdd'
Require stack:
- /Users/shunsuke.h/.nodenv/versions/16.13.1/lib/node_modules/amplify-localstack/index.js
- /snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js
- /snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js
- /snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/bin/amplify

Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the project identifier from: 'amplify diagnose --send-report'
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: a8be5fd8-a90d-48a0-a556-0f552d13f16c

Because of node version?

I could not find any solution…

I couldn’t reproduce your issue, even with the same node version. But based on the error message I wrote this PR that adds the missing files.