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

fix: add better error messaging when initializing an already initialized project #13166

Merged
merged 11 commits into from
Sep 20, 2023
Merged

fix: add better error messaging when initializing an already initialized project #13166

merged 11 commits into from
Sep 20, 2023

Conversation

rtpascual
Copy link
Contributor

@rtpascual rtpascual commented Aug 29, 2023

Description of changes

Catch earlier and provide better error messaging when initializing an already initialized project with defaults (running amplify init -y for an already initialized project).

The error message changed when running amplify init -y the second time:
Invalid environment name: undefined -> Amplify project <appId> is already initialized with environment <currentEnv>

Issue #, if available

Fixes #11579

Description of how you validated changes

Added unit test for running amplify init -y for an initialized project and expecting the new error message.

Manually ran amplify-dev init -y twice, the second time gives the new error message (the same applies if initializing an app with a custom env name then running amplify-dev init -y):

Screenshot 2023-09-07 at 6 06 07 PM

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Pull request labels are added

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@rtpascual rtpascual requested a review from a team as a code owner August 29, 2023 18:07
bombguy
bombguy previously approved these changes Aug 30, 2023
@rtpascual rtpascual changed the title fix: add better error messaging for subsequent init with default env fix: add better error messaging when initializing an already initialized project Sep 7, 2023
Copy link
Member

@sobolk sobolk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

bombguy
bombguy previously approved these changes Sep 20, 2023
Copy link
Contributor

@bombguy bombguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rtpascual rtpascual merged commit f45f7d0 into aws-amplify:dev Sep 20, 2023
@rtpascual rtpascual deleted the better-env-messaging branch September 25, 2023 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

receiving Invalid environment name: undefined when running amplify init -y in an initialized project
3 participants