Skip to content

fix: show helpful error when docker is missing during bundling fallback#37521

Open
knQzx wants to merge 1 commit intoaws:mainfrom
knQzx:fix-esbuild-docker-error-msg
Open

fix: show helpful error when docker is missing during bundling fallback#37521
knQzx wants to merge 1 commit intoaws:mainfrom
knQzx:fix-esbuild-docker-error-msg

Conversation

@knQzx
Copy link
Copy Markdown

@knQzx knQzx commented Apr 4, 2026

Summary

  • when esbuild is not installed and cdk falls back to docker bundling, a missing docker would show a cryptic spawnSync docker ENOENT error
  • now it clearly says docker is not installed and suggests installing esbuild locally as an alternative
  • added a test for the ENOENT case in dockerExec

Test plan

  • added unit test that stubs spawnSync to return ENOENT and checks for the new error message
  • verified the error includes both the "not installed" explanation and the esbuild suggestion

fixes #22997

when esbuild is not installed locally, cdk falls back to docker bundling.
if docker is also missing, the error was just 'spawnSync docker ENOENT'
which is confusing - now it tells users what's actually wrong and suggests
installing esbuild to skip docker entirely.

fixes aws#22997
@knQzx knQzx requested a review from a team as a code owner April 4, 2026 17:14
@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Apr 4, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team April 4, 2026 17:14
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter fails with the following errors:

❌ Fixes must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

✅ A exemption request has been requested. Please wait for a maintainer's review.

@knQzx
Copy link
Copy Markdown
Author

knQzx commented Apr 4, 2026

Exemption Request

this change only improves an error message when docker is not found (ENOENT) during asset bundling - it doesn't change any cloudformation output or runtime behavior. an integration test for this would require docker to not be installed, which doesn't make sense in a normal test environment.

the fix is fully covered by unit tests in packages/aws-cdk-lib/core/test/private/asset-staging.test.ts that mock spawnSync to return an ENOENT error and verify the improved error message is thrown.

requesting pr-linter/exempt-integ-test label.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(cdk synth): incorrect and confused message about spawnSync docker ENOENT

2 participants