Recently, my react-router project started failing on a POST request. It’s weird since it does not do much, just a FETCH request.
I then narrowed it down to, whenever FETCH gets called, something crashes hardcore and I can’t even catch the error, no idea why.
It works locally perfectly, but when deployed, errors
The logs on the platform say nothing
I’ve managed to reproduce the issue in a simple repo, basically created using Vercel’s templates and added one commit
The expected output is of course a 200 and both before and after console messages being printed, or in a bad case, the ERROR from the catch. We get the before but nothing after
Using httpie
http --verify=no POST https://react-router-bug.vercel.app/test
I deployed a patched version of react-router that disables sanitizeError and got this traceback:
DOMException [AbortError]: This operation was aborted
at new DOMException (node:internal/per_context/domexception:53:5)
at AbortController.abort (node:internal/abort_controller:465:18)
at IncomingMessage.<anonymous> (/opt/rust/nodejs.js:2:1816)
at Object.onceWrapper (node:events:632:28)
at IncomingMessage.emit (node:events:518:28)
at emitCloseNT (node:internal/streams/destroy:148:10)
at process.processTicksAndRejections (node:internal/process/task_queues:89:21)
Also, the request does successfully complete, and by adding logging to the promise in the background I have sometimes got it to log the result of the request.
It appears that it’s just the response stream that is getting aborted.
There was a new version of the runtime that made a few changes, which is why it only broke on new deploys but not old ones. I don’t know too much beyond that yet