aws-amplify / aws-amplify/amplify-cli
dynamodb mocking reports cannot create preexisting table if there are more than 100 tables.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### How did you install the Amplify CLI?
npm
### If applicable, what version of Node.js are you using?
22
### Amplify CLI Version
13, 14 and others
### What operating system are you using?
Mac OS
### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
nothing
### Describe the bug
1. define more than 100 tables in schema graphql file like
```
type Table000 @model {
id: String
}
type Table001 @model {
id: String
}
...
type Table101 @model {
id: String
}
```
2. start mock server with command `amplify mock api`
3. shut down mock server after server up with tables created.
4. start mock server again with command `amplify mock api`. it will fails with error
```
Creating new table XXXTable
Failed to start API Mocking. Running cleanup tasks.
Reason: Cannot create preexisting table
```
### Expected behavior
it should not create new tables because it's already created.
### Reproduction steps
1. define more than 100tables in schema graphql file.
2. start mock server with command `amplify mock api`
2. shut down mock server after tables created.
3. start mock server again. it will fails with error `Reason: Cannot create preexisting table`
### Project Identifier
_No response_
### Log output
```
# Put your logs below this line
Creating new table XXTable
Failed to start API Mocking. Running cleanup tasks.
Reason: Cannot create preexisting table
```
### Additional information
The cause is that DynamoDB Java Client's listTables method is limited to return 100 tables by default, the Local Dynamodb doesnt implement to list all tables that cause it trying to create exiting tables at mock server starting.
### Before submitting, please confirm:
- [x] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [x] I have removed any sensitive information from my code snippets and submission.
Contributor guide
Research direction
Start by reproducing the issue with amplify mock api and more than 100 GraphQL @model tables, then inspect the DynamoDB Java client's listTables behavior described in the report. The fix is complete when restarting the mock server recognizes all existing tables and no longer reports Cannot create preexisting table.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, java, typescript
- Domain
- backend, cli, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100