`wrangler pages dev` 404s some functions/routes
See original GitHub issuefunctions/index.ts
and functions/*/index.ts
, functions/_middleware.ts
and functions/*/_middleware.ts
work, but nothing else. For example, functions/*/*/index.ts
does not work. Parameterized paths also don’t work.
I’m on Windows. To repro, open new folder, npm init
, npm i wrangler@alpha
, create functions
folder, create index.ts
, insert:
export const onRequestGet: PagesFunction<{}> = async ({ request, env }): Promise<Response> => {
return new Response("hello1", { status: 200 })
}
Run npx wrangler pages dev ./
. Move it to functions/index.ts
, http://localhost:8788/ works fine. Move it to functions/test/test/index.ts
, http://localhost:8788/test/test/ returns a 404.
The other day, this was happening both when building on Cf and when I tried using wrangler pages dev
. Now it’s just happening with wrangler. This seems like an isolated case, so let me know if there’s any more info I can provide.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Top GitHub Comments
Should have put my comment here. It’s a bug in the code generator:
https://github.com/cloudflare/wrangler2/issues/50#issuecomment-997289714
It seems as though that PR (or another one from 0.0.16) introduced a bug where the “route deduplication” is disregarding methods. This doesn’t seem like it would be a Windows exclusive issue, but I’ve gone ahead and made another PR #465.