question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws-s3): CDK in parallel mode. Lambda service: Could not unzip uploaded file.

See original GitHub issue

Describe the bug

I have CD pipeline in Github action. The pipeline first runs CDK synth for the whole app. After that it will run multiple cdk deploy parallel job using outdir as cdk app, one job for each stack. Im facing once in a while with error.

Multiple stack uses same assets and are uploading files to S3 parallel.

I don’t know if the artifact is already broken after build (don’t think so) or does S3 break even small files when uploading those with same name to the shared cdk asset bucket?

I have used same pipeline few months and this problem started around two weeks ago.

Expected Behavior

No errors and parallel deployment works fine.

Current Behavior

Zip file is corrupted. I cannot open the file at my machine even.

XXXXX | 4:09:34 PM | UPDATE_FAILED        | AWS::Lambda::Function                       | rds-cluster/XXXXX-XXXX-lambda (XXXXXX) Resource handler returned message: "Could not unzip uploaded file. Please check your file, then try to upload again. (Service: Lambda, Status Code: 400, Request ID: XXXXX-XXXXX-4c03-91d5-XXXXXXX)" (RequestToken: XXXXX-XXXXXX-XXXXX-9e9a-XXXXXX, HandlerErrorCode: InvalidRequest)

Reproduction Steps

Not easy job to reproduce.

  1. CDK synth
  2. CDK deploy with cdk.out as an cdk app in parallel
  3. Happens sometimes

Possible Solution

.

Additional Information/Context

No response

CDK CLI Version

2.19.0 (build e0d3e62)

Framework Version

No response

Node.js Version

16.4.12

OS

Github managed runner

Language

Typescript

Language Version

Typescript (4.6.3)

Other information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:5
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
NGL321commented, Apr 7, 2022

Since this is a super edge case (and likely to be troublesome to find the root cause), I am marking it as low priority for researching a fix. However, if you are able to identify the cause directly I can upgrade its priority for fix implementation.

1reaction
thdxrcommented, Dec 14, 2022

We are also running into this issue at SST since we deploy stacks in parallel by default and all stacks have an identical function within them. I also believe this is a tmp file issue and not an s3 issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws cloudformation error: Could not unzip uploaded file. ...
An error occur: Could not unzip uploaded file. Please check your file, then try to upload again. (Service: AWSLambdaInternal; Status Code: ...
Read more >
aws-cdk/aws-s3-deployment module
IMPORTANT The aws-s3-deployment module is only intended to be used with zip files from trusted sources. Directories bundled by the CDK CLI (by...
Read more >
@aws-cdk/aws-s3-deployment | Yarn - Package Manager
This library allows populating an S3 bucket with the contents of .zip files from other S3 buckets or from local disk. The following...
Read more >
Efficiently Streaming a Large AWS S3 File via S3 Select
This approach does not require any external libraries for processing. ... AWS S3 is an industry-leading object storage service.
Read more >
Tag Archives: AWS CDK - Noise
The first Lambda function will deploy the CodeBuild project, which then deploys the feature pipeline. This can take a few minutes. You can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found