Skip to content

fix(wrangler): run asset directory validation during --dry-run#13036

Merged
petebacondarwin merged 1 commit intocloudflare:mainfrom
pbrowne011:pbrowne/deploy-dryrun-asset-check
Mar 24, 2026
Merged

fix(wrangler): run asset directory validation during --dry-run#13036
petebacondarwin merged 1 commit intocloudflare:mainfrom
pbrowne011:pbrowne/deploy-dryrun-asset-check

Conversation

@pbrowne011
Copy link
Copy Markdown
Contributor

@pbrowne011 pbrowne011 commented Mar 24, 2026

Summary

wrangler deploy --dry-run currently skips the entire syncAssets() call, which means asset directory validation checks (_worker.js exposure detection, file size limits) are also skipped. A real deploy fails with a clear error, but --dry-run silently passes.

This fix exports buildAssetManifest() from assets.ts and calls it during --dry-run when assets are configured. This runs the same filesystem validation as a real deploy without deploying anything, making API calls, or altering the behavior or --dry-run.

Testing

One new test in assets.test.ts verifies that --dry-run catches a _worker.js file in the asset directory.

Note

The same gap exists in the wrangler versions upload --dry-run path. This PR scopes the fix to wrangler deploy, but buildAssetManifest is now exported and available if maintainers want to apply the same check there (either here or in a separate PR).


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: bug fix

A picture of a cute animal (not mandatory, but encouraged)

image

Lihn Mai from the National Zoo with her aunt Swarna


Open with Devin

@pbrowne011 pbrowne011 requested a review from a team as a code owner March 24, 2026 04:14
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 24, 2026

🦋 Changeset detected

Latest commit: b10d7de

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Mar 24, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Mar 24, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 24, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13036

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13036

miniflare

npm i https://pkg.pr.new/miniflare@13036

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13036

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13036

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13036

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13036

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13036

wrangler

npm i https://pkg.pr.new/wrangler@13036

commit: b10d7de

@petebacondarwin petebacondarwin merged commit 0b4c21a into cloudflare:main Mar 24, 2026
49 of 52 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Mar 24, 2026
@pbrowne011 pbrowne011 deleted the pbrowne/deploy-dryrun-asset-check branch March 26, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants