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

Stack [amplify-XXX] already exists when amplify init #14017

Closed
2 tasks done
nelmasry opened this issue Nov 18, 2024 · 7 comments
Closed
2 tasks done

Stack [amplify-XXX] already exists when amplify init #14017

nelmasry opened this issue Nov 18, 2024 · 7 comments
Labels
headless Headless mode for CI/CD pending-triage Issue is pending triage

Comments

@nelmasry
Copy link

nelmasry commented Nov 18, 2024

How did you install the Amplify CLI?

npm (npm install -g @aws-amplify/cli@latest)

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

18.x

Amplify CLI Version

12.13.0 & 10.0.0

What operating system are you using?

ubuntu-latest

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

Nothing, suddenly it stopped working.

Describe the bug

I'm working with amplify with github actions to automate deployments and was working fine, suddenly it started to fail showing me error that Stack [amplify-XXX] already exists when amplify init
I have checked #11120 (comment) and tried downgrading amplify cli to 10.0.0 as mentioned in the thread but it didn't fix the issue, it just changed the error to
AlreadyExistsException: Stack [amplify-xxx] already exists at Request.extractError (/snapshot/repo/build/node_modules/aws-sdk/lib/protocol/query.js:50:29) at Request.callListeners (/snapshot/repo/build/node_modules/aws-sdk/lib/sequential_executor.js:106:20)

Expected behavior

Pipeline works normally and deploy to existing environments without issues.

Reproduction steps

Create github actions pipeline to deploy amplify existing env

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.
@nelmasry nelmasry added the pending-triage Issue is pending triage label Nov 18, 2024
@ykethan
Copy link
Member

ykethan commented Nov 18, 2024

Hey @nelmasry, thank you for reaching out. Could you try using amplify pull --appId <app-id> --envName next --yes instead of amplify init --appId <app-id> --envName next --yes and let us know if this mitigates the issue.

@ykethan ykethan added pending-response Issue is pending response from the issue author headless Headless mode for CI/CD labels Nov 18, 2024
@nelmasry
Copy link
Author

hi @ykethan , yes i have tried but for some reason amplify pull command can not find the app with the sent app Id, although i run amplify list apps and app exists, even when send same aws credentials and region
image

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Nov 19, 2024
@ykethan
Copy link
Member

ykethan commented Nov 19, 2024

Hey @nelmasry, could you try adding a --debug to the pull command. Additionally, using the same aws credential if you run amplify pull without an appId or envName does amplify provide a list of amplify apps?

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Nov 19, 2024
@nelmasry
Copy link
Author

@ykethan
When i tried pull without app Id i got this error message
Current environment cannot be determined. Resolution: Use 'amplify init' in the root of your app directory to create a new environment. Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Nov 20, 2024
@ykethan
Copy link
Member

ykethan commented Nov 20, 2024

@nelmasry apologies, could you run this outside your existing project directory. The amplify pull should provide you prompt to select from a list apps present in the account. could you test it in your local environment with similar credentials and region to verify if it does provide the app-id.
Additionally, is the workflow currently using AWS SSO credentials?

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Nov 20, 2024
@nelmasry
Copy link
Author

hi @ykethan
After investigating the issues I encountered, I discovered they were all related to an invalid team-provider-info.json file:

  • The error Cannot read properties of undefined (reading 'Region') occurred because one of the environments was missing the AWS Region property (for some reason).
  • For the current issue, Stack [amplify-XXX] already exists, it was also caused by a missing environment in the team-provider-info.json file. Once I added the environment, everything worked fine without needing to use amplify pull or other workarounds.

Honestly, I'm not sure why you didn’t suggest checking this file, as it seems to be the root cause of such issues. This was also the case in other bug reports like this one.

Anyway, thank you for your support and efforts to help. The issue is now resolved.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Nov 22, 2024
Copy link

This issue is now closed. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
headless Headless mode for CI/CD pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

2 participants