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

(aws-s3-deployment): Fails to deploy when a large number of object keys are present #28579

Closed
watersry opened this issue Jan 4, 2024 · 5 comments · Fixed by #31452 or softwaremill/tapir#4137 · May be fixed by NOUIY/aws-solutions-constructs#135 or NOUIY/aws-solutions-constructs#136
Assignees
Labels
@aws-cdk/aws-s3-deployment bug This issue is a bug. effort/medium Medium work item – several days of effort p1

Comments

@watersry
Copy link

watersry commented Jan 4, 2024

Describe the bug

When using the BucketDeployment for a large number of individual source files, the custom resource correctly persists them to S3, but ultimately fails the deployment due the large response send back to CloudFormation, exceeding the 4k limit for response objects.

Expected Behavior

The Cfn deployment should succeed if the BucketDeployment's underlying custom resource succeeds.

Current Behavior

Cfn fails to deploy the stack with Response object is too long despite the BucketDeployment lambda succeeding and successfully deploying all resources as expected.

Reproduction Steps

Any bucket deployment where the number of sources is sufficient to exceed the 4k response count. In our case, 50 config files succeeded to persist to s3 but failed due to the response to Cfn.

    new BucketDeployment(this, `Deployment`, {
      sources: configs.map((conf) => Source.jsonData("someKey", conf)), 
      destinationBucket: bucket,
      memoryLimit: 1024,
      prune: false,
    });

Possible Solution

The underlying custom resource provides the ability to choose an output path in the response, this could be used to truncate the response to Cfn and avoid this issue when the number of keys is sufficiently large or if a user intentionally configures it to do so.

Additional Information/Context

No response

CDK CLI Version

2.103.1

Framework Version

No response

Node.js Version

18

OS

any

Language

TypeScript

Language Version

No response

Other information

No response

@watersry watersry added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 4, 2024
@pahud
Copy link
Contributor

pahud commented Jan 4, 2024

Looks like we need to fix it through the custom resource output path.

@pahud pahud added p1 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jan 4, 2024
@mrlikl
Copy link
Contributor

mrlikl commented Jul 24, 2024

@pahud Can I submit a PR to re-use SourceObjectKeys in the objectKeys() method ?

The CR lambda is essentially sending back the same data in the response which is hitting the limit for close to 50 object uploads.

Particularly this is being a limitation when using servicecatalog.ProductStack, if there are local assets beyond a particular number, the Custom::CDKBucketDeployment would fail with the error Response object is too long which is a hard limit of 4096 bytes.

Please LMK your thoughts on this.

@pahud
Copy link
Contributor

pahud commented Jul 24, 2024

@mrlikl I am not pretty sure how you would implement your PR. My initial idea is to allow user optionally specify the output path in the BucketDeployment construct props to work it around but there might be better solution.

Feel free to submit your PR so we have better visibility and hopefully move it forward.

Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

1 similar comment
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.