cloudflare / cloudflare/workers-sdk
internal error; reference = — in local dev fetch() to https URLs, goes away when URL is http — traces to middleware-ensure-req-body-drained
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.5k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 186
Description
### What versions & operating system are you using?
Wrangler latest, also tried Wrangler 4.14.3, macos latest
### Please provide a link to a minimal reproduction
https://github.com/irvinebroque/broken
### Describe the Bug
This code:
```ts
export default {
async fetch(request, env, ctx): Promise {
return fetch('https://cloudflare.com');
},
} satisfies ExportedHandler;
```
(or anything that makes a subrequest) — fails with an error like this:
`internal error; reference = o52qhlf1tg3pfgpu24d1q0bh`
```
[wrangler:inf] GET / 500 Internal Server Error (65ms)
[wrangler:err] Error: internal error; reference = 43hj7e49i133rl2j5p5p8re7
at async Object.fetch (file:///Users/brendan/src/broken/src/index.ts:3:15)
at async jsonError (file:///Users/brendan/src/broken/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts:22:10)
at async drainBody (file:///Users/brendan/src/broken/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts:5:10)
```
**If you change the URL to `http` rather than `https` it's fine.**
### Repro:
https://github.com/irvinebroque/broken
- fails even when WARP is not running
- I reproduced this with new machine and no special WARP certs installed
- does not fail when using Wrangler v `~3.10.0`
Contributor guide
Assessment
This issue has not been assessed yet.