-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
core: CrossRegionExportReader: Response object is too long #25114
Comments
Hi @antoncohen , stack names in AWS CDK have a maximum length of 128 characters. It might be better to have a look at name length to rule it out. |
It isn't a general stack name length issue, as far as I can tell. You can see the stack name in the error message and reproduction example code. The longest stack name is 83 characters. Everything is created fine in the primary region (cross-region writer), it only fails in the replica region (cross-region reader). And if the |
We likely need a similar fix like this one that was abandoned. The issue is likely that the response in the custom resource handler is too long (over 4096 bytes) |
running into this bug as well, what @peterwoodworth mentioned sounds right, when I look at the custom resource handler cloudwatch logs I don't see any errors, but the response object looks like it is likely over 4096 bytes. maybe we can store the response object in an s3 bucket and then just return a reference to the object in s3. |
This behavior prevents me from being able to deploy to more regions and thus prevents me from spending more money on aws ;) |
This is a CloudFormation limitation stemming from custom resource provider responses being limited to 4096 bytes - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/crpg-ref-responses.html. In the specific use case you've provided you can fix this by shortening the overall stack name by either shortening the stack prefix or by not using nested stacks which is adding to the stack name length. Longer term I'm not sure there is a good alternative here. We can't truncate or provide something like Lines 86 to 89 in 2c53cf9
|
…ure from response objects being too large (#30115) ### Issue #23958, #25114 ### Reason for this change Using the `crossRegionReference` flag on `StackProps` can produce deployment errors associated with response objects being too large. The root cause of this is a CloudFormation limitation that restricts the total size of a custom resource provider response body to [4096 bytes](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/crpg-ref-responses.html). Using `crossRegionReference` will create a custom resource in both the producing stack and the consuming stack. The custom resource provider in the producing stack will respond back to CloudFormation with a response object that includes all exported parameter names and values. Similarly, the consuming stack will respond back to CloudFormation with a response object that includes all imported parameter names and values. The parameter names are created with the following naming format: `/cdk/exports/${consumingStackName}/${export-name}`. Users need to be careful about stack names and the use of nested stacks to limit the overall length of parameter names which will limit the size of the response body. This PR adds documentation to give more context about this issue and ways to help mitigate it. ### Description of changes Added documentation. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Describe the bug
When using
crossRegionReferences: true
thecdk deploy
fails in the reader region withResponse object is too long
.Similar to #23958, but on the reader side, likely with a different root cause.
Expected Behavior
I expect
crossRegionReferences: true
to work, and it be possible to reference variables across stacks in different regions.Current Behavior
When referencing a variable in a stack in a different region, it fails in the reader region with this error:
This is using Nested Stacks, and long stack names, with multiple cross-region references.
Reproduction Steps
Node.js: 18.15.0
CDK bin and lib: 2.73.0
TypeScript: 5.0.4
Command:
npx cdk deploy --all --require-approval=never --verbose --debug --app 'npx ts-node app.ts'
app.ts:
At the top of
app.ts
the constantACCOUNT_ID
will need to be changed. The constantNUMBER_OF_KEYS_TO_CREATE
can be lowered below 9 to not trigger the error.I don't see any errors in the Lambda logs. Parameter Store values are written. And in the reader region the Parameter Store tags are set and removed, according to the Lambda logs.
Possible Solution
My guess is that it is triggered long stack names, including nested stacks creating even longer reference names.
Additional Information/Context
No response
CDK CLI Version
2.73.0 (build 43e681e)
Framework Version
No response
Node.js Version
18.15.0
OS
macOS
Language
Typescript
Language Version
TypeScript (5.0.4)
Other information
No response
The text was updated successfully, but these errors were encountered: