Skip to content

Cancelling bundling of Lambda function causes next deployment to fail #33201

@rtpascual

Description

@rtpascual

Describe the bug

Cancelling cdk synth when a Lambda function is bundling can cause an empty bundling-temp-<hash> folder in cdk.out. This results in the next deployment of the Lambda to fail with InvalidParameterValueException: Uploaded file must be a non-empty zip.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

CDK does not use existing bundling-temp folder if it is empty.

Current Behavior

CDK uses existing empty bundling-temp folder for deployment.

Reproduction Steps

  1. Setup Amplify (Gen 2) https://docs.amplify.aws/react/start/manual-installation/
  2. Setup a function https://docs.amplify.aws/react/build-a-backend/functions/set-up-function/
  3. Run npx ampx sandbox --debug
  4. Ctrl+C right when Bundling asset <Lambda>/Code/Stage... appears
  5. Notice empty bundling-temp folder in cdk.outImage
  6. Run npx ampx sandbox again

Possible Solution

No response

Additional Information/Context

We are seeing this for Amplify customers but I believe this can happen using only CDK for example in #18459 (comment).

CDK CLI Version

2.176.0

Framework Version

No response

Node.js Version

22.13.1

OS

Linux/Mac/Windows (More frequently on Windows from what we've seen)

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/coreRelated to core CDK functionalitybugThis issue is a bug.effort/mediumMedium work item – several days of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions