-
Notifications
You must be signed in to change notification settings - Fork 87
Description
How did you install the Amplify CLI?
nem
If applicable, what version of Node.js are you using?
v18.20.2
Amplify CLI Version
1.0.1
What operating system are you using?
MacOS
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
I have 60 models. I'm trying to migrate to Gen 2.npx ampz sandbox
command tried to push, then got this warning:
Number of resources: 421 is approaching allowed maximum of 500
Template size is approaching limit: 824168/1000000. Split resources into multiple stacks or set suppressTemplateIndentation to reduce template size. [ack: @aws-cdk/core:Stack.templateSize]
then I tried to test reach limit and got error like this:
Caused By: Error: Number of resources in stack 'amplify-amplifygen2demo-marlonjd-sandbox-608dc1dabf/data/amplifyData/ConnectionStack': 505 is greater than allowed maximum of 500: AWS::AppSync::FunctionConfiguration (336), AWS::AppSync::Resolver (168), AWS::CDK::Metadata (1)
So, I was able to fix this limit issue by creating custom stacks for some resolvers like in documents, Place AppSync Resolvers in Custom-named Stacks.
And I could fix template size limit issue by doing amplify push --minify
I couldn't do these in Gen 2. So how can we fix this?
Just info:
I saw this example to splitting stack with cdk, it may help this article
I saw people could solve this issue when they're using aws-cdk
and serverless (framework)
by using split-stacks.
Expected behavior
Should update stack
Reproduction steps
Creating big schema will give this error. I added some test models like this. If models have much relations, it will started to increase resource counts quickly.
Test0: a
.model({
name: a.string(),
test1Id: a.id(),
test1: a.belongsTo("Test1", "test1Id"),
test2id: a.id(),
test2: a.belongsTo("Test2", "test2id"),
})
.authorization((allow) => [allow.authenticated()]),
Test1: a
.model({
name: a.string(),
test0s: a.hasMany("Test0", "test1Id"),
test2id: a.id(),
test2: a.belongsTo("Test2", "test2id"),
test7s: a.hasMany("Test7", "test1id"),
})
.authorization((allow) => [allow.authenticated()]),
Test2: a
.model({
name: a.string(),
test1s: a.hasMany("Test1", "test2id"),
test3id: a.id(),
test3: a.belongsTo("Test3", "test3id"),
test7s: a.hasMany("Test7", "test2id"),
test0s: a.hasMany("Test0", "test2id"),
})
.authorization((allow) => [allow.authenticated()]),
Test3: a
.model({
name: a.string(),
test2s: a.hasMany("Test2", "test3id"),
test4id: a.id(),
test4: a.belongsTo("Test4", "test4id"),
test5id: a.id(),
test5: a.belongsTo("Test5", "test5id"),
test7s: a.hasMany("Test7", "test3id"),
})
.authorization((allow) => [allow.authenticated()]),
Test4: a
.model({
name: a.string(),
test3s: a.hasMany("Test3", "test4id"),
test6id: a.id(),
test6: a.belongsTo("Test6", "test6id"),
test7s: a.hasMany("Test7", "test4id"),
})
.authorization((allow) => [allow.authenticated()]),
Test5: a
.model({
name: a.string(),
test3s: a.hasMany("Test3", "test5id"),
test7s: a.hasMany("Test7", "test5id"),
})
.authorization((allow) => [allow.authenticated()]),
Test6: a
.model({
name: a.string(),
test4s: a.hasMany("Test4", "test6id"),
test7id: a.id(),
test7: a.belongsTo("Test7", "test7id"),
test8id: a.id(),
test8: a.belongsTo("Test8", "test8id"),
})
.authorization((allow) => [allow.authenticated()]),
Test7: a
.model({
name: a.string(),
test6s: a.hasMany("Test6", "test7id"),
test1id: a.id(),
test1: a.belongsTo("Test1", "test1id"),
test2id: a.id(),
test2: a.belongsTo("Test2", "test2id"),
test3id: a.id(),
test3: a.belongsTo("Test3", "test3id"),
test4id: a.id(),
test4: a.belongsTo("Test4", "test4id"),
test5id: a.id(),
test5: a.belongsTo("Test5", "test5id"),
})
.authorization((allow) => [allow.authenticated()]),
Test8: a
.model({
name: a.string(),
test6s: a.hasMany("Test6", "test8id"),
})
.authorization((allow) => [allow.authenticated()]),
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.