remix: Remix crashes with web-fetch 4.3.2/1.8.2
What version of Remix are you using?
1.8.2
Steps to Reproduce
See sandbox: https://codesandbox.io/p/sandbox/solitary-wave-1l0skr Failing test PR: https://github.com/remix-run/remix/pull/4994
- Observe exit code 1 (remix crashes, premature close error) when fetcher loads from /load.tsx route, which calls fetch from a Google drive URL
- Go to load.tsx, uncomment the import that uses web-fetch 4.3.1
- Remix no longer crashes
Expected Behavior
web-fetch’s fetch should work, without crashing remix, returning a valid HTML result
Actual Behavior
remix crashes, exit code 1
/project/sandbox/node_modules/@remix-run/node/node_modules/@remix-run/web-fetch/src/fetch.js:342
const error = Object.assign(new Error('Premature close'), {
^
Error: Premature close
at TLSSocket.onSocketClose (/project/sandbox/node_modules/@remix-run/node/node_modules/@remix-run/web-fetch/src/fetch.js:342:33)
at TLSSocket.emit (node:events:525:35)
at node:net:757:14
at TCP.done (node:_tls_wrap:584:7)
error Command failed with exit code 1.
Related issues:
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 6
- Comments: 30 (18 by maintainers)
I’m surprised that something that crashes Remix isn’t getting any attention.
PR created with a possible fix: https://github.com/remix-run/web-std-io/pull/29
Plz review
@brophdawg11 no errors so far 👍
We’ve had this issue (intermittently on prod only) and we’ve updated to
1.19.2-pre.0and are testing it out now. Will update this issue if we continue to experience the Premature close errorThe error does not occur if you have
connection: keep-alivein the headers. I think axios sets that automatically.FYI… Here’s the diff between 4.3.1 and 4.3.2
fetch.js
request.js