-
Notifications
You must be signed in to change notification settings - Fork 103
Description
Environment information
System:
OS: Linux 6.6 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
CPU: (6) arm64 unknown
Memory: 4.86 GB / 15.60 GB
Shell: /bin/bash
Binaries:
Node: 22.16.0 - /usr/local/bin/node
Yarn: 1.22.22 - /usr/local/bin/yarn
npm: 10.9.2 - /usr/local/bin/npm
pnpm: undefined - undefined
NPM Packages:
@aws-amplify/auth-construct: 1.8.1
@aws-amplify/backend: 1.16.1
@aws-amplify/backend-ai: Not Found
@aws-amplify/backend-auth: 1.7.1
@aws-amplify/backend-cli: 1.8.0
@aws-amplify/backend-data: 1.6.1
@aws-amplify/backend-deployer: 2.1.3
@aws-amplify/backend-function: 1.14.1
@aws-amplify/backend-output-storage: 1.3.1
@aws-amplify/backend-secret: 1.4.0
@aws-amplify/backend-storage: 1.4.1
@aws-amplify/cli-core: 2.2.1
@aws-amplify/client-config: 1.8.0
@aws-amplify/data-construct: 1.16.3
@aws-amplify/data-schema: 1.21.0
@aws-amplify/deployed-backend-client: 1.8.0
@aws-amplify/form-generator: 1.2.1
@aws-amplify/model-generator: 1.2.0
@aws-amplify/platform-core: 1.10.0
@aws-amplify/plugin-types: 1.11.0
@aws-amplify/sandbox: 2.1.2
@aws-amplify/schema-generator: 1.4.0
@aws-cdk/toolkit-lib: 1.1.1
aws-amplify: 6.15.3
aws-cdk-lib: 2.189.1
typescript: 5.8.3
No AWS environment variables
No CDK environment variables
Describe the bug
When deploying with npx ampx sandbox, the following error occurs. (xxxxxx is a placeholder because the original value includes the app name and username.)
After checking, the template size for the data stack in
.amplify/artifacts/cdk.out/amplifyxxxxxxsandbox71a64dcc04data71394BCF.nested.template.json
exceeded 1 MB.
I found that CDK’s Stack.suppressTemplateIndentation (https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html#suppresstemplateindentation) can minify the CloudFormation template JSON. However, amplify-backend does not provide an API to configure this.
Workaround
By forcibly enabling CDK Stack.suppressTemplateIndentation as shown below, the template JSON gets minified:
amplify/backend.ts:
// Suppress indentation changes to the CloudFormation template
backend.data.stack._suppressTemplateIndentation = true;Reproduction steps
Deploy after increasing the number of resources included in the data stack using the following approach:
- Define many custom queries/mutations in data/resources.ts
- Set "data" as the resourceGroupName for defineFunction