Hi, when deploying a repo based on cfnewup through Cloudflare Workers Builds / Git integration, the deployment fails with Wrangler 4.x.
Reproduction
Cloudflare build settings:
Build command: None
Deploy command: npx wrangler deploy
Root directory: /
The repo contains _worker.js.
The deployment reaches Wrangler and then fails:
Executing user deploy command: npx wrangler deploy
npm warn exec The following package was not found and will be installed: wrangler@4.128.0
⛅️ wrangler 4.128.0
────────────────────
✘ [ERROR] Could not detect a directory containing static files (e.g. html, css and js) for the project
Failed: error occurred while running deploy command
Possible Cause
_worker.js is recognized specially by Cloudflare Pages, but wrangler deploy for a normal Worker needs a Worker entrypoint to be specified.
The current wrangler.toml does not appear to declare _worker.js as main, so current Wrangler tries project/static asset auto-detection instead of treating _worker.js as the Worker entrypoint.
Suggested fix
Declare _worker.js explicitly in wrangler.toml:
main = "_worker.js"
compatibility_date = "2026-01-20"
Alternatively, the deployment command would need to specify the entrypoint explicitly:
npx wrangler deploy ./_worker.js
I think adding main = "_worker.js" upstream is preferable, since then Git-connected Cloudflare Workers deployments work with the standard:
My current edition that works: https://github.com/NeumoNeumo/cfpau/tree/main
Hi, when deploying a repo based on
cfnewupthrough Cloudflare Workers Builds / Git integration, the deployment fails with Wrangler 4.x.Reproduction
Cloudflare build settings:
The repo contains
_worker.js.The deployment reaches Wrangler and then fails:
Possible Cause
_worker.jsis recognized specially by Cloudflare Pages, butwrangler deployfor a normal Worker needs a Worker entrypoint to be specified.The current
wrangler.tomldoes not appear to declare_worker.jsasmain, so current Wrangler tries project/static asset auto-detection instead of treating_worker.jsas the Worker entrypoint.Suggested fix
Declare
_worker.jsexplicitly inwrangler.toml:Alternatively, the deployment command would need to specify the entrypoint explicitly:
I think adding
main = "_worker.js"upstream is preferable, since then Git-connected Cloudflare Workers deployments work with the standard:My current edition that works: https://github.com/NeumoNeumo/cfpau/tree/main