amplify-cli: unable to initialize project with auth from git, missing `auth/.../build/parameters.json`
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.
How did you install the Amplify CLI?
pnpm
If applicable, what version of Node.js are you using?
16.13.1
Amplify CLI Version
7.6.8
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
Amplify Categories
auth
Amplify Commands
init
Describe the bug
Unable to initialize new environment from an Amplify project after freshly cloning from git due to missing parameters.json in the auth resource’s build/ directory. As a workaround, we can run amplify build to generate the missing file and allow us to initialize an environment.
Note: we are also unable to use the --app parameter of init to initialize a project from git:
amplify init --app git@github.com:josefaidt/missingauth.git
✔ Successfully created initial AWS cloud resources for deployments.
✔ Initialized provider successfully.
✖ There was an error initializing your environment.
Error: File at path: '/Users/josef/Documents/projects/aws-amplify/reproductions/missingauth2/amplify/backend/auth/missingauthbf3f264f/build/parameters.json' does not exist
at Function.JSONUtilities.readJson (/Users/josef/.fnm/node-versions/v16.13.1/installation/pnpm-global/5/node_modules/.pnpm/amplify-cli-core@2.4.7/node_modules/amplify-cli-core/src/jsonUtilities.ts:25:15)
at StateManager.getData (/Users/josef/.fnm/node-versions/v16.13.1/installation/pnpm-global/5/node_modules/.pnpm/amplify-cli-core@2.4.7/node_modules/amplify-cli-core/src/state-manager/stateManager.ts:399:32)
at StateManager.getResourceParametersJson (/Users/josef/.fnm/node-versions/v16.13.1/installation/pnpm-global/5/node_modules/.pnpm/amplify-cli-core@2.4.7/node_modules/amplify-cli-core/src/state-manager/stateManager.ts:147:17)
at ensureAmplifyMetaFrontendConfig (/Users/josef/.fnm/node-versions/v16.13.1/installation/pnpm-global/5/node_modules/.pnpm/@aws-amplify+cli@7.6.8/node_modules/@aws-amplify/cli/src/extensions/amplify-helpers/on-category-outputs-change.ts:84:55)
at AmplifyToolkit.onCategoryOutputsChange [as _onCategoryOutputsChange] (/Users/josef/.fnm/node-versions/v16.13.1/installation/pnpm-global/5/node_modules/.pnpm/@aws-amplify+cli@7.6.8/node_modules/@aws-amplify/cli/src/extensions/amplify-helpers/on-category-outputs-change.ts:18:5)
at initializeEnv (/Users/josef/.fnm/node-versions/v16.13.1/installation/pnpm-global/5/node_modules/.pnpm/@aws-amplify+cli@7.6.8/node_modules/@aws-amplify/cli/src/initialize-env.ts:103:27)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at onSuccess (/Users/josef/.fnm/node-versions/v16.13.1/installation/pnpm-global/5/node_modules/.pnpm/@aws-amplify+cli@7.6.8/node_modules/@aws-amplify/cli/src/init-steps/s9-onSuccess.ts:68:3)
at Object.run (/Users/josef/.fnm/node-versions/v16.13.1/installation/pnpm-global/5/node_modules/.pnpm/@aws-amplify+cli@7.6.8/node_modules/@aws-amplify/cli/src/commands/init.ts:30:7)
at Object.executeAmplifyCommand (/Users/josef/.fnm/node-versions/v16.13.1/installation/pnpm-global/5/node_modules/.pnpm/@aws-amplify+cli@7.6.8/node_modules/@aws-amplify/cli/src/index.ts:373:5)
at executePluginModuleCommand (/Users/josef/.fnm/node-versions/v16.13.1/installation/pnpm-global/5/node_modules/.pnpm/@aws-amplify+cli@7.6.8/node_modules/@aws-amplify/cli/src/execution-manager.ts:178:3)
at executeCommand (/Users/josef/.fnm/node-versions/v16.13.1/installation/pnpm-global/5/node_modules/.pnpm/@aws-amplify+cli@7.6.8/node_modules/@aws-amplify/cli/src/execution-manager.ts:30:5)
at Object.run (/Users/josef/.fnm/node-versions/v16.13.1/installation/pnpm-global/5/node_modules/.pnpm/@aws-amplify+cli@7.6.8/node_modules/@aws-amplify/cli/src/index.ts:205:5)
Expected behavior
New or existing environment is initialized
Reproduction steps
amplify init -yamplify add auth> choose defaults with usernameamplify push -y- add to git (sample: https://github.com/josefaidt/missingauth.git)
- cd to an empty sibling directory,
mkdir ../missingauthtmp; cd ../missingauthtmp - clone from git
git clone git@github.com:josefaidt/missingauth.git - attempt to initialize the project with
amplify init> create new environment - observe error
Workaround
- run
amplify build - observe resource build directory is created and populated
- initialize with
amplify init
GraphQL schema(s)
# Put schemas below this line
Log output
# Put your logs below this line
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 7
- Comments: 15 (3 by maintainers)
Just FYI @josefaidt if worth something, I had this problem with amplify CLI 10.3.0, I try to update the auth resource but it didn’t work so I went to build settings and change to amplify 10.2.3 and it worked, perhaps this latest version is introducing an issue.
Project Identifier: 7c991c00dbf89c25ef50f4c169fe031eI’m having this issue on the CI, wonder how to deal with this if the build is something that runs on the CI. 🤔