Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to initialize project with auth from git, missing auth/.../build/parameters.json #9508

Closed
4 tasks done
josefaidt opened this issue Jan 12, 2022 · 15 comments · Fixed by #10058
Closed
4 tasks done
Assignees
Labels
auth Issues tied to the auth category of the CLI bug Something isn't working p1 platform-init Issues related to initializing a new Amplify project

Comments

@josefaidt
Copy link
Contributor

josefaidt commented Jan 12, 2022

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

  1. amplify init -y
  2. amplify add auth > choose defaults with username
  3. amplify push -y
  4. add to git (sample: https://github.com/josefaidt/missingauth.git)
  5. cd to an empty sibling directory, mkdir ../missingauthtmp; cd ../missingauthtmp
  6. clone from git git clone git@github.com:josefaidt/missingauth.git
  7. attempt to initialize the project with amplify init > create new environment
  8. observe error

Workaround

  1. run amplify build
  2. observe resource build directory is created and populated
  3. initialize with amplify init

GraphQL schema(s)

# Put schemas below this line

Log output

# Put your logs below this line


Additional information

No response

@josefaidt josefaidt added bug Something isn't working platform-init Issues related to initializing a new Amplify project labels Jan 12, 2022
@stevenlafl
Copy link

stevenlafl commented Jan 23, 2022

+1 Having the same problem. Same service, auth.

Edit: This worked for me:

  1. Pull down the code as says in the Amplify Studio "Local setup instructions" section. (the amplify pull command)
  2. Copy out the amplify/team-provider-info.json file into your existing code location.
  3. Run amplify init
  4. Run amplify push

Seems to provision the correct resources. 3 and 4 should happen automatically if you push the code into your git repository, according to docs. However I have not tested that.

@adi518
Copy link

adi518 commented Feb 6, 2022

Getting the exact same bug. Unacceptable. Our preview builds don't work because of this. The workaround didn't work either, nor do I see how it should help. I already pulled the environment and pushed whatever updates it had to the branch I'm building an environment from.

@Leandros
Copy link

Leandros commented Feb 9, 2022

Same issue here. Our entire auth stack is gone.

@swaminator
Copy link
Contributor

@Leandros @adi518 can you please provide repro steps?

@adi518
Copy link

adi518 commented Feb 14, 2022

Build a preview environment with the latest major version of the cli and it should fail when using a social auth provider (e.g., Google). I finally managed to work around it today by tapping into the Amplify config before it starts creating the environment and removing any social providers, so it skips the problem altogether. I should say this pipeline used to work fine with a much older version of the cli. However, since the sabotage in colors.js, the cli had to be inevitably upgraded to the latest (the sabotage was purposely released as a patch), which lead to these new regressions when deploying a preview environment.

@phaedonmit
Copy link

Is there a recommended fix for this?

@danshev
Copy link

danshev commented Mar 20, 2022

Same -- does anyone from AWS ever respond?

amplify remove auth >> menu of stuff to delete

amplify update auth >> build/parameters.json' does not exist

@may215
Copy link

may215 commented Apr 7, 2022

I have the same issue here? Any updates??

@InnovateWithEric
Copy link

This is fixed in 8.0.1 @may215

@josefaidt josefaidt linked a pull request Apr 12, 2022 that will close this issue
3 tasks
@duranmla
Copy link

I'm having this issue on the CI, wonder how to deal with this if the build is something that runs on the CI. 🤔

@duranmla
Copy link

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: 7c991c00dbf89c25ef50f4c169fe031e

@WebManifestation
Copy link

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: 7c991c00dbf89c25ef50f4c169fe031e

Thanks, this worked. But would really like to know why this happened with this newer version of amplify cli.

@priyaprabhakar07
Copy link

I have the same error message with parameter.json while trying to initialise amplify environment, once I downgrade to 10.2.3 it is fixed

I am keen to know why this happened in the latest amplify cli version(10.3.0) and
how to track whether this is fixed in the latest version?

@josefaidt josefaidt reopened this Oct 19, 2022
@josefaidt
Copy link
Contributor Author

josefaidt commented Oct 19, 2022

Hey folks 👋 I was able to reproduce this issue using the following steps:

  1. amplify init -y
  2. amplify add auth
  3. amplify update auth > add user pool groups
  4. amplify push -y
  5. git init
  6. git clean -fXd remove gitignored from local directory (to simulate fresh clone)
  7. amplify init --envName dev --yes

I've reopened this issue to track with 10.3.0

As a workaround, you can manually create a parameters.json file in the auth resource's build directory with an empty object as the contents {} prior to the headless init. In the case of Amplify Hosting, you can run this before amplifyPush --simple

cd amplify/backend/auth/<resource-name>/ && mkdir build && echo '{}' > build/parameters.json && cd -

@josefaidt josefaidt added the regression Flair label to track regressions label Oct 19, 2022
@josefaidt josefaidt removed the regression Flair label to track regressions label Oct 19, 2022
@josefaidt
Copy link
Contributor Author

Revisiting this, I'm going to re-close in favor of tracking the new active bug as a regression #11211

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Issues tied to the auth category of the CLI bug Something isn't working p1 platform-init Issues related to initializing a new Amplify project
Projects
None yet
Development

Successfully merging a pull request may close this issue.