"run_worker_first" not behaving as expected
https://developers.cloudflare.com/workers/static-assets/routing/worker-script/#run-worker-first-for-selective-paths
The documentation above says that we can add to our wrangler.toml the run_worker_first line, for static asssets, where we can specify certain paths where the static assets should be routed through the worker first.
[assets]
directory = "./dist/"
not_found_handling = "single-page-application"
binding = "ASSETS"
run_worker_first = [ "/oauth/callback" ]
I do something very similar in my own wrangler.toml, which looks like such:
[assets]
directory = "public"
not_found_handling = "single-page-application"
binding = "ASSETS"
run_worker_first = [ "/assets" ]
However, I get this error when I go to deploy the worker:
⛅️ wrangler 4.18.0 (update available 4.23.0)
─────────────────────────────────────────────
✘ [ERROR] Processing wrangler.toml configuration:
- Expected "assets.run_worker_first" to be of type boolean but got ["/assets"].
The docs also show run_worker_first being used as a boolean variable? I'm confused what to do here. Thanks.
2 Replies