Ah, I found the issue. This doesn't work with `wrangler2 pages dev`
Ah, I found the issue. This doesn't work with
wrangler2 pages devwrangler2 pages devwrangler2 pages dev frontend/dist, I get an error:✘ [ERROR] Could not validate _routes.json at /home/jeroen/project/frontend/dist: Error: ENOENT: no such file or directory, open '/home/jeroen/project/frontend/dist/_routes.json'
✘ [ERROR] 1 error(s) and 0 warning(s) when compiling Worker.
▲ [WARNING] Failed to bundle _worker.js. Error: Build failed with 1 error:
../../.wrangler/tmp/bundle-sGxLQ0/middleware-insertion-facade.js:1:43: ERROR: Could not resolve
"/home/jeroen/project/frontend/dist/_worker.js"
at failureErrorWithLog
(/usr/lib/node_modules/wrangler/node_modules/esbuild/lib/main.js:1636:15)
at /usr/lib/node_modules/wrangler/node_modules/esbuild/lib/main.js:1048:25
at /usr/lib/node_modules/wrangler/node_modules/esbuild/lib/main.js:1512:9
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errors: [
{
detail: undefined,
id: '',
location: [Object],
notes: [],
pluginName: '',
text: 'Could not resolve
"/home/jeroen/project/frontend/dist/_worker.js"'
}
],
warnings: []
}Compiled Worker successfully
frontend/dist directory, my worker will not work. It won't even be detected. So CloudFlare seems to insist my worker already exists before the build command is ran, and then compiles it while the build command runs.sleep 60, at no point does CloudFlare try to build the worker until the sleep is over. However, if I add a && sleep 60 to my build command, cloudflare will try to build my worker before the sleep has even started.wrangler.toml?wrangler reads your config when using Pageswrangler dev, so it unintentionally reads the config, even though it shouldn'tshim.mjs shouldn't be in the output directory at all. Maybe try moving it somewhere else?wrangler2 doesn't seem to have any parameters that allow me to set the "public" directory to a subfolder.wrangler?deploy commandworker out of dist, and then update the import in _worker.js?_worker.js, it should be bundled automaticallywrangler does not deploy to any connected domains. Any clues on this?

functions folder taken from a tutorial I am following. Is that the only thing I need to do? I cannot see the functionality from the functions folder. I am following this: https://dev.to/charca/password-protection-for-cloudflare-pages-8ma . Does the functions folder need to be part of the build as well as in build/functions?Is the max Worker CPU time feature out yet?Yes.
If so, is it available for Pages Functions?Yes.


command = "( cd backend && cargo install -q worker-build && worker-build --release ) && ( cd frontend && yarn run build )"wrangler2 pages dev frontend/distfrontend/distsleep 60&& sleep 60shim.mjswrangler2deploy❯ tree dist
dist
├── _astro
│ └── index.efe4faea.css
├── favicon.svg
├── index.html
├── _routes.json
├── worker
│ ├── index.wasm
│ └── shim.mjs
└── _worker.jsworker_worker.js_worker.jsbuild/functionswrangler pages dev --kv=MY_KV --compatibility-date=2023-10-30 --proxy 3000 -- npm run devexport default defineEventHandler(({ context }) => {
return context;
});{
"_nitro": {
"routeRules": {}
},
"nitro": {
"errors": []
},
"matchedRoute": {
"path": "/api/hello",
"handlers": {}
},
"params": {}
}[proxy]: [nuxt] [request error] [unhandled] [500] Cannot read properties of undefined (reading 'env')wrangler2 pages deploy dist --project-name=project