`wrangler pages dev -- astro dev` fails to follow Astro redirects

Astro project with wrangler pages dev -- astro dev and default adapter fails to properly execute an Astro redirect return context.redirect("/login", 302) with [wrangler] Could not proxy request: TypeError: fetch failed. Deployed version works. Only dev fails. Astro runs on localhost:3000, and Wrangler on localhost:8788 Node 18.18.2
2 Replies
Varna
Varna4mo ago
I assume, that CF is trying to proxy a 302 redirect, but instead of redirect Proxy fails on fetch.
return Response.redirect(url.toString(), 302)
return Response.redirect(url.toString(), 302)
[proxy]: 23:19:37 [302] POST /api/login 1049ms

✘ [ERROR] Error: Could not proxy request: TypeError: fetch failed

at
/Users/varna/Code/monorepo/apps/accounts/node_modules/wrangler/wrangler-dist/cli.js:105869:29
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async #handleLoopbackCustomService
(/Users/varna/Code/monorepo/apps/accounts/node_modules/miniflare/dist/src/index.js:8107:24)
at async #handleLoopback
(/Users/varna/Code/monorepo/apps/accounts/node_modules/miniflare/dist/src/index.js:8151:20)


[wrangler:inf] POST /api/login 502 Bad Gateway (1129ms)
[proxy]: 23:19:37 [302] POST /api/login 1049ms

✘ [ERROR] Error: Could not proxy request: TypeError: fetch failed

at
/Users/varna/Code/monorepo/apps/accounts/node_modules/wrangler/wrangler-dist/cli.js:105869:29
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async #handleLoopbackCustomService
(/Users/varna/Code/monorepo/apps/accounts/node_modules/miniflare/dist/src/index.js:8107:24)
at async #handleLoopback
(/Users/varna/Code/monorepo/apps/accounts/node_modules/miniflare/dist/src/index.js:8151:20)


[wrangler:inf] POST /api/login 502 Bad Gateway (1129ms)
_Pear
_Pear4mo ago
I've been seeing the same thing with sveltekit. Makes the dev mode very difficult to use.
Want results from more Discord servers?
Add your server
More Posts