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

Error when trying to add a new environment from cli #13198

Closed
2 tasks done
wangdavidhao opened this issue Sep 8, 2023 · 5 comments
Closed
2 tasks done

Error when trying to add a new environment from cli #13198

wangdavidhao opened this issue Sep 8, 2023 · 5 comments
Labels
pending-response Issue is pending response from the issue author pending-triage Issue is pending triage

Comments

@wangdavidhao
Copy link

How did you install the Amplify CLI?

$ npm install -g @aws-amplify/cli

If applicable, what version of Node.js are you using?

20.2.0

Amplify CLI Version

12.2.3

What operating system are you using?

Mac M1

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No

Describe the bug

Hello !

I am trying to add a new env called prod on my project using
amplify env add

After submitting the name and the authentication method, I got this error:
✖ Initializing your environment: prod
✖ There was an error initializing your environment
🛑 Could not initialize platform for 'prod': Missing required key 'Bucket' in params

But using the command amplify env list, the env is created (probably due to a new empty bloc named prod inside team-provider-info.json) and I am currently using this env:

| Environments |
| ------------ |
| staging |
| *prod |


Then, when I try to checkout to my staging env with amplify env checkout staging, I got this error:

✖ Initializing your environment: staging
✖ There was an error initializing your environment.
🛑 There was an error building the custom resources
No package manager found. Please install npm, yarn, or pnpm to compile overrides for this project.\

Resolution: There may be errors in your custom resource file. If so, fix the errors and try again.\ Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

But I am indeed inside my staging env, as stated when using the command amplify status:

Current Environment: staging

But now, If I want to push some changes using amplify push to staging, I get this error:

No package manager found. Please install npm, yarn, or pnpm to compile overrides for this project.

Now, I can't create a new environment, and when returning to my previous environment, it also doesn't work anymore.

Is there any possible solution to resolve this ? Thanks !!

Expected behavior

New env is successfully created

Reproduction steps

  1. amplify env add
  2. amplify env checkout newEnv
  3. amplify push

Project Identifier

No response

Log output

# Put your logs below this line


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.
@wangdavidhao wangdavidhao added the pending-triage Issue is pending triage label Sep 8, 2023
@josefaidt
Copy link
Contributor

Hey @wangdavidhao 👋 thanks for raising this! I was not able to immediately reproduce this using CLI 12.4.0, however I have a few follow-up questions to better understand the context of the issue you are experiencing:

  • would you mind posting the project ID output from amplify diagnose --send-report?
  • are you able to consistently reproduce this? if so, what is the error and stack trace output from running the same command with --debug?
  • the "npm missing" error is interesting, similar to the previous ask what is the output of amplify env checkout staging --debug?

Despite the issue, as a workaround, can you try the following:

  1. remove gitignored files with git clean -fXd (this will remove the local prod env references stored in amplify/.config/ and remove the affected amplify-meta.json file)
  2. if the prod CloudFormation stack exists, delete it
  3. if the prod S3 bucket remains after deleting the stack, empty and delete
  4. pull the staging env with amplify pull --appId <your-app-id> --envName staging (this will initialize the project locally with the staging env)
  5. retry creation of prod env with amplify env add

@josefaidt josefaidt added the pending-response Issue is pending response from the issue author label Sep 8, 2023
@josefaidt
Copy link
Contributor

Hey @wangdavidhao I wanted to follow up here and see if you're still experiencing this?

@ykethan
Copy link
Member

ykethan commented Dec 13, 2023

closing the issue due to inactivity. please feel free in reaching out to us, we would be happy in diving deeper.

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2023
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@Dmitresky
Copy link

Hey @wangdavidhao 👋 thanks for raising this! I was not able to immediately reproduce this using CLI 12.4.0, however I have a few follow-up questions to better understand the context of the issue you are experiencing:

  • would you mind posting the project ID output from amplify diagnose --send-report?
  • are you able to consistently reproduce this? if so, what is the error and stack trace output from running the same command with --debug?
  • the "npm missing" error is interesting, similar to the previous ask what is the output of amplify env checkout staging --debug?

Despite the issue, as a workaround, can you try the following:

  1. remove gitignored files with git clean -fXd (this will remove the local prod env references stored in amplify/.config/ and remove the affected amplify-meta.json file)
  2. if the prod CloudFormation stack exists, delete it
  3. if the prod S3 bucket remains after deleting the stack, empty and delete
  4. pull the staging env with amplify pull --appId <your-app-id> --envName staging (this will initialize the project locally with the staging env)
  5. retry creation of prod env with amplify env add

It helps me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-response Issue is pending response from the issue author pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

4 participants