cloudflare / cloudflare/workers-sdk
🐛 BUG: Error loop/hang with `passThroughOnException` and no host
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.5k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 186
Description
### Which Cloudflare product(s) does this pertain to?
Wrangler
### What version(s) of the tool(s) are you using?
3.91.0
### What version of Node are you using?
_No response_
### What operating system and version are you using?
macOS
### Describe the Bug
### Setup
```
wrangler.toml
src/
index.js
```
```toml
# ./wrangler.toml
name = "my-app"
main = "./src/index.js"
compatibility_date = "2024-11-26"
```
```js
// ./src/index.js
export default {
fetch(request, env, ctx) {
ctx.passThroughOnException();
throw new Error("bang");
}
}
```
### Observed behavior
1. `npx wrangler dev --no-bundle --host example.com`
1. `curl http://localhost:8787/`
1. Error twice(?) in Wrangler and return `example.com` response to cURL
1. `npx wrangler dev --no-bundle`
3. `curl http://localhost:8787/`
4. Error loop in Wrangler and hang waiting for a response in cURL
### Expected behavior
- With a `--host`, error just once(?)
- Without a `--host`, I have no idea...? Error once in Wrangler and return a null-body 500-status response for cURL?
### Please provide a link to a minimal reproduction
_No response_
### Please provide any relevant error logs
Some behind-the-scenes chat about this: https://cflare.co/passthru
Contributor guide
Assessment
This issue has not been assessed yet.