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

poor error handling when reaching Amplify app limit #10063

Closed
5 tasks done
jhockett opened this issue Mar 24, 2022 · 6 comments · Fixed by #10158
Closed
5 tasks done

poor error handling when reaching Amplify app limit #10063

jhockett opened this issue Mar 24, 2022 · 6 comments · Fixed by #10158
Assignees
Labels
bug Something isn't working p3 platform-init Issues related to initializing a new Amplify project platform-state Issues related to project state management

Comments

@jhockett
Copy link
Contributor

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.
  • I have removed any sensitive information from my code snippets and submission.

How did you install the Amplify CLI?

Applies to all installations

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

N/A

Amplify CLI Version

7.6.26

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.

N/A

Amplify Categories

Not applicable

Amplify Commands

add, update

Describe the bug

At time of writing, there's a 25 Amplify application limit for a single AWS account in a given region. When this limit is reached, the CLI will not fail gracefully and can result in a misleading error message about a missing appId and a stack trace dump.

Expected behavior

A helpful error message with next steps.

Reproduction steps

Create 25 Amplify apps
Initialize a new Amplify app and try to run various operations with the CLI

GraphQL schema(s)

# Put schemas below this line

Log output

# Put your logs below this line


Additional information

image
image (1)

@jhockett jhockett added bug Something isn't working platform-init Issues related to initializing a new Amplify project platform-state Issues related to project state management labels Mar 24, 2022
@josefaidt josefaidt added the p3 label Mar 28, 2022
@SebasRod23
Copy link
Contributor

Hello, if nobody is working on this I would like to give it a try

@jhockett
Copy link
Contributor Author

Awesome @SebasRod23! Before opening a pull request, could you provide an overview of your solution in this issue? That way we can align on an approach before you spend time working on it.

@SebasRod23
Copy link
Contributor

Sure, as soon as I get a possible solution I will share it to you. First, I would like to reproduce this issue and check the documentation to help me design a solution. Do you have any tips?

@SebasRod23
Copy link
Contributor

Hi @jhockett. I was able to reproduce the issue and I have an idea for a possible solution that I would like to discuss before start coding it. I think we can add some validation for the amplify init command that will check that the amplify-meta.json has the attribute "AmplifyAppId" (the reason for this is because every new project, once the application limit has been reached, will not have this ID) and if it doesn't, it will throw an error explaining that the application limit has been reached.

To make this validation we can use the getAppId function from secretName.ts and wrap it in a try-catch to throw the new and more helpful error message if the attribute is not found, an alternative would be to make a similar function that would throw the new error message.

@jhockett
Copy link
Contributor Author

jhockett commented Apr 6, 2022

Hi @SebasRod23, apologies for the late response.

I think the approach you laid out can work, but for now let's stick to printing a warning message since it won't affect existing behavior. The exact behavior and messaging will be decided in an API review, so I wouldn't bother implementing anything more complex than a warning for now.

I think a more ideal solution would be to check the total number of apps present in the given region before init begins, but it's more complicated and beyond the scope of this PR.

@SebasRod23
Copy link
Contributor

Perfect, I will start working on this solution with these changes.

SebasRod23 added a commit to SebasRod23/amplify-cli that referenced this issue Apr 7, 2022
Validate that the app limit has not been reached by checking the meta file and print a warning it it
has been reached

Closes aws-amplify#10063
akshbhu pushed a commit that referenced this issue May 5, 2022
…10158)

* fix: validate that the app limit has not been reached

Validate that the app limit has not been reached by checking the meta file and print a warning it it
has been reached

Closes #10063

* refactor: change context.print to printer

* refactor: change message content

* fix: update warning message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p3 platform-init Issues related to initializing a new Amplify project platform-state Issues related to project state management
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants