Next.js Discord

Discord Forum

Fetch failed // undici SSL routines

Unanswered
Donskoy posted this in #help-forum
Open in Discord
Avatar
DonskoyOP
I keep getting this insane bug across recent nexts, I have tried different versions of next. I have tried everything. The app worked fine until deployment to Vercel, and now Ithis is a new issue.

what on earth is this:

TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11372:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
cause: [Error: C09E19D701000000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:355:
] {
library: 'SSL routines',
reason: 'wrong version number',
code: 'ERR_SSL_WRONG_VERSION_NUMBER'
}
}

Even if I have error handling on the page, if this fetch fails it brings the whole app down.
tried it most recently with:
"next": "13.4.12",
"react": "18.2.0",

This seems to be a persistent bug: https://www.google.com/search?q=Unhandled+Runtime+Error+Error%3A+fetch+failed+Call+Stack+Object.fetch+node%3Ainternal%2Fdeps%2Fundici%2Fundici&rlz=1C5CHFA_enPR939PR942&sourceid=chrome&ie=UTF-8

and trying different node versions hasn't helped.

23 Replies

Avatar
Dunker
add .env file this NODE_TLS_REJECT_UNAUTHORIZED=0
Avatar
DonskoyOP
still getting this in the logs:

- event compiled client and server successfully in 595 ms (1810 modules)
(node:73298) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use node --trace-warnings ... to show where the warning was created)
TypeError: fetch failed
at Object.fetch (/Users/me/code/repos/github.com/me/frontend/node_modules/next/dist/compiled/undici/index.js:1:26669)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
cause: [Error: 7903747776:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:
] {
library: 'SSL routines',
function: 'ssl3_get_record',
reason: 'wrong version number',
code: 'ERR_SSL_WRONG_VERSION_NUMBER'
}
}
- error TypeError: fetch failed
Avatar
Dunker
do you have any SSL cert in your pc for this project
Avatar
DonskoyOP
nope, AFAIK. I left that to Vercel/Cloudflare.

this is just trying to get a project that once worked to even run in local dev. No idea where this error started from.
Avatar
Dunker
if is working on local and not vercel, its related with vercel domains ssl
so its like #vercel-help
Avatar
DonskoyOP
I'm seeing this locally, oddly enough
Avatar
Dunker
can you try removing next build cache via deleting .next folder
and node_modules
cuz i am using latest version and dont have this errors
Avatar
DonskoyOP
still the same :/

For the longest time, I was using 13.4.10 and then I tried upgrading to the latest 14.1 (a few days back). Everything broke, so I tried going back down to where I had a stable app for months. I have tried to remove .next and node_modules all allong the way. I am not sure what has keept this Undici error - some people said going to node 16 would help (it hasnt). I've tried a bunch of different next versions to no avail.
did you encounter this once?
Avatar
Dunker
not at all
can i see it via live share
at vscode
Avatar
DonskoyOP
1 sec lemme see
Avatar
Asiatic Lion
@Donskoy hi, did you fix this issue?
Avatar
B33 underestimated me correct :(
@Donskoy same question, any fix?
Avatar
Asiatic Lion
@B33 underestimated me correct :( I decided to use cloudflare worker as a proxy, can't find any other solution...
Avatar
B33 underestimated me correct :(
Ouch wtf
Vercel shld really do smthn abt this
Avatar
Asiatic Lion
@B33 underestimated me correct :( this is actually related to node. It works on version 16, you can do same thing as I did on cloudflare, but on vercel with just plain node 16 project, but the thing is that, 16th version will be deprecated in February on Vercel.
Avatar
B33 underestimated me correct :(
Hmm intresting, thanks gonna try