aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

fix(cli): large context causes E2BIG error during synthesis on Linux

Open otaviomacedo opened this issue 2 years ago • 5 comments

Linux systems don't support environment variables larger than 128KiB. This change splits the context into two if it's larger than that and stores the overflow into a temporary file. The application then re-constructs the original context from these two sources.

A special case is when this new version of the CLI is used to synthesize an application that depends on an old version of the framework. The application will still consume part of the context, but the CLI warns the user that some of it has been lost.

Since the tree manipulation logic is basically the same as the one used for displaying notices, it was extracted into its own file.

Re-roll #21230 Fixes #19261


All Submissions:

Adding new Unconventional Dependencies:

  • [ ] This PR adds new unconventional dependencies following the process described here

New Features

  • [ ] Have you added the new feature to an integration test?
    • [ ] Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license Instead of passing the context in an environment variable, the CLI now writes the context to a temporary file and sets an environment variable only with the location. The app then uses that location to read from the file.

Also tested manually on a Linux machine.

Re-roll #21230 Fixes #19261

otaviomacedo avatar Jul 29 '22 11:07 otaviomacedo

gitpod-io[bot] avatar Jul 29 '22 11:07 gitpod-io[bot]

@Mergifyio update

Naumel avatar Aug 31 '22 09:08 Naumel

update

✅ Branch has been successfully updated

mergify[bot] avatar Aug 31 '22 09:08 mergify[bot]

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

mergify[bot] avatar Sep 22 '22 14:09 mergify[bot]

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

mergify[bot] avatar Sep 26 '22 07:09 mergify[bot]

@Mergifyio update

TheRealAmazonKendra avatar Oct 05 '22 02:10 TheRealAmazonKendra

update

✅ Branch has been successfully updated

mergify[bot] avatar Oct 05 '22 02:10 mergify[bot]

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 61fb1482014e97340112c04468a162e4b742959b
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

aws-cdk-automation avatar Oct 05 '22 02:10 aws-cdk-automation

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

mergify[bot] avatar Oct 05 '22 02:10 mergify[bot]