(aws-s3): CDK in parallel mode. Lambda service: Could not unzip uploaded file.
See original GitHub issueDescribe 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.
- CDK synth
- CDK deploy with cdk.out as an cdk app in parallel
- 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:
- Created a year ago
- Reactions:5
- Comments:8 (5 by maintainers)
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.
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