aws-amplify / amplify-backend

Home to all tools related to Amplify's code-first DX (Gen 2) for building fullstack apps on AWS
Apache License 2.0
141 stars 45 forks source link

Amplify Gen 2 - cannot run example at "https://docs.amplify.aws/react/start/account-setup/", errors #1714

Open cloudbaseaws opened 4 days ago

cloudbaseaws commented 4 days ago

Environment information

[cloudshell-user@ip-10-130-93-159 ~]$ npx ampx info
npm notice 
npm notice New major version of npm available! 9.8.1 -> 10.8.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.1
npm notice Run npm install -g npm@10.8.1 to update!
npm notice 
npm ERR! could not determine executable to run

npm ERR! A complete log of this run can be found in: /home/cloudshell-user/.npm/_logs/2024-07-04T03_31_35_507Z-debug-0.log

NOTE: I then ran npm install -g npm@10.8.1 and ran npm apmx info again

[cloudshell-user@ip-10-130-93-159 ~]$ npx ampx info
npm ERR! could not determine executable to run

npm ERR! A complete log of this run can be found in: /home/cloudshell-user/.npm/_logs/2024-07-04T03_41_48_033Z-debug-0.log

[cloudshell-user@ip-10-130-93-159 ~]$ npx --version
9.8.1

Description

When performing instructions per: https://docs.amplify.aws/react/start/account-setup/ ran into issue as follows. . (a) after this instruction: "Paste the following command in the CloudShell terminal and enter an email address you would like to associate with this AWS account:" . (b) performed this instruction: response=$(aws sso-admin list-instances) ssoId=$(echo $response | jq '.Instances[0].IdentityStoreId' -r) ssoArn=$(echo $response | jq '.Instances[0].InstanceArn' -r) email_json=$(jq -n --arg email "$user_email" '{"Type":"Work","Value":$email}') response=$(aws identitystore create-user --identity-store-id $ssoId --user-name amplify-admin --display-name 'Amplify Admin' --name Formatted=string,FamilyName=Admin,GivenName=Amplify --emails "$email_json") userId=$(echo $response | jq '.UserId' -r) response=$(aws sso-admin create-permission-set --name amplify-policy --instance-arn=$ssoArn --session-duration PT12H) permissionSetArn=$(echo $response | jq '.PermissionSet.PermissionSetArn' -r) aws sso-admin attach-managed-policy-to-permission-set --instance-arn $ssoArn --permission-set-arn $permissionSetArn --managed-policy-arn arn:aws:iam::aws:policy/service-role/AmplifyBackendDeployFullAccess accountId=$(aws sts get-caller-identity | jq '.Account' -r) aws sso-admin create-account-assignment --instance-arn $ssoArn --target-id $accountId --target-type AWS_ACCOUNT --permission-set-arn $permissionSetArn --principal-type USER --principal-id $userId

Hit enter"

==========

========== log from part above follows: please see error line 36

[cloudshell-user@ip-10-130-93-159 ~]$ [cloudshell-user@ip-10-130-93-159 ~]$ cat /home/cloudshell-user/.npm/_logs/2024-07-04T03_31_35_507Z-debug-0.log 0 verbose cli /usr/bin/node-18 /usr/lib/node_modules_18/npm/bin/npm-cli.js 1 info using npm@9.8.1 2 info using node@v18.18.2 3 timing npm:load:whichnode Completed in 2ms 4 timing config:load:defaults Completed in 3ms 5 timing config:load:file:/usr/lib/node_modules_18/npm/npmrc Completed in 3ms 6 timing config:load:builtin Completed in 3ms 7 timing config:load:cli Completed in 3ms 8 timing config:load:env Completed in 0ms 9 timing config:load:project Completed in 1ms 10 timing config:load:file:/home/cloudshell-user/.npmrc Completed in 0ms 11 timing config:load:user Completed in 0ms 12 timing config:load:file:/etc/npmrc Completed in 1ms 13 timing config:load:global Completed in 1ms 14 timing config:load:setEnvs Completed in 2ms 15 timing config:load Completed in 15ms 16 timing npm:load:configload Completed in 15ms 17 timing config:load:flatten Completed in 4ms 18 timing npm:load:mkdirpcache Completed in 0ms 19 timing npm:load:mkdirplogs Completed in 0ms 20 verbose title npm exec ampx info 21 verbose argv "exec" "--" "ampx" "info" 22 timing npm:load:setTitle Completed in 1ms 23 timing npm:load:display Completed in 0ms 24 verbose logfile logs-max:10 dir:/home/cloudshell-user/.npm/_logs/2024-07-04T03_31_35_507Z- 25 verbose logfile /home/cloudshell-user/.npm/_logs/2024-07-04T03_31_35_507Z-debug-0.log 26 timing npm:load:logFile Completed in 12ms 27 timing npm:load:timers Completed in 0ms 28 timing npm:load:configScope Completed in 0ms 29 timing npm:load Completed in 64ms 30 silly logfile done cleaning log files 31 timing arborist:ctor Completed in 1ms 32 http fetch GET 200 https://registry.npmjs.org/npm 315ms (cache miss) 33 http fetch GET 200 https://registry.npmjs.org/ampx 320ms (cache miss) 34 timing command:exec Completed in 446ms 35 notice 35 notice New major version of npm available! 9.8.1 -> 10.8.1 35 notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.1 35 notice Run npm install -g npm@10.8.1 to update! 35 notice 36 verbose stack Error: could not determine executable to run 36 verbose stack at getBinFromManifest (/usr/lib/node_modules_18/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js:17:23) 36 verbose stack at exec (/usr/lib/node_modules_18/npm/node_modules/libnpmexec/lib/index.js:188:15) 36 verbose stack at async module.exports (/usr/lib/node_modules_18/npm/lib/cli-entry.js:61:5) 37 verbose pkgid ampx@0.2.1 38 verbose cwd /home/cloudshell-user 39 verbose Linux 6.1.94-99.176.amzn2023.x86_64 40 verbose node v18.18.2 41 verbose npm v9.8.1 42 error could not determine executable to run 43 verbose exit 1 44 timing npm Completed in 1053ms 45 verbose code 1 46 error A complete log of this run can be found in: /home/cloudshell-user/.npm/_logs/2024-07-04T03_31_35_507Z-debug-0.log [cloudshell-user@ip-10-130-93-159 ~]$ . (c) per your instructions: I am making a report: . ... validate that this worked, run the following command in the CloudShell. If something failed in this process, please report an issue. Keep this information readily available for the next step.

. Help appreciated, perhaps my configuration needs to be corrected? Thank you.

ykethan commented 3 days ago

Hey @cloudbaseaws, thank you for reaching out. Are you running npx ampx in cloudshell? From the logs the error is occurring when trying to run ampx in cloudshell npx was unable to find this in the existing folder. The command is intended to be run locally inside a project that contains the @aws-amplify/backend-cli packages.

21 verbose argv "exec" "--" "ampx" "info"

for example, when running in a project that does not contain the package.

image