TypeError: fetch failed
Answered
Eastern yellowjacket posted this in #help-forum
Eastern yellowjacketOP
TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11730:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async invokeRequest (/app/node_modules/next/dist/server/lib/server-ipc/invoke-request.js:17:12)
at async invokeRender (/app/node_modules/next/dist/server/lib/router-server.js:254:29)
at async handleRequest (/app/node_modules/next/dist/server/lib/router-server.js:447:24)
at async requestHandler (/app/node_modules/next/dist/server/lib/router-server.js:464:13)
at async Server.<anonymous> (/app/node_modules/next/dist/server/lib/start-server.js:117:13) {
cause: Error: connect ECONNREFUSED 127.0.0.1:46511
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 46511
}
}I'm running next.js 14 on docker on an ubuntu server.
This error is caused when accessing to any api router, and the 500 Internal Server Error Page continues to be displayed.
Strangely, the error did not occur on my windows computer.
Answered by Eastern yellowjacket
solved. My docker environment was strange. I should have used node:slim simply.
Sorry Jaymes, I couldn't help you. GOOD LUCK!
Sorry Jaymes, I couldn't help you. GOOD LUCK!
26 Replies
try wrapping the fetch in a try catch
but first see why is it failing
but first see why is it failing
Eastern yellowjacketOP
I'm not using a server side fetch in an api route code.
Prisma in the code may throw an error, but it must log the error.
Prisma in the code may throw an error, but it must log the error.
Pixiebob
@Eastern yellowjacket Did you manage to solve it?
Eastern yellowjacketOP
yes
Pixiebob
how? You can show?
Eastern yellowjacketOP
I don’t have my computer now
Pixiebob
ok, when can you send me what you can send, I'm having the same problem
I've tried everything
Western paper wasp
how ?
fix
Eastern yellowjacketOP
I tried changing next.js version
13.5.4 or 14.0.0 exit code 139
13.4.19 typeerror fetch failed
13.5.4 or 14.0.0 exit code 139
13.4.19 typeerror fetch failed
Eastern yellowjacketOP
And i made an api router that returns a plain text, but this error occurred. This error only occurs running not on local but on docker image.
@Pixiebob Are you running nextjs on docker?
@Pixiebob Are you running nextjs on docker?
why nextjs fetch the port like this

@Eastern yellowjacket I tried changing next.js version
13.5.4 or 14.0.0 exit code 139
13.4.19 typeerror fetch failed
Eastern yellowjacketOP
I think
>= v13.15.0 exit code with ..
< v13.15.0 typeerror
>= v13.15.0 exit code with ..
< v13.15.0 typeerror
Pixiebob
good morning @Eastern yellowjacket
my error when build project
my nextjs is 14
my request
funny that running "next dev" everything works fine
now when the .next folder does not exist, the project does not build
@Pixiebob good morning <@835036688849043468>
Eastern yellowjacketOP
it’s night in my country.😪
Eastern yellowjacketOP
solved. My docker environment was strange. I should have used node:slim simply.
Sorry Jaymes, I couldn't help you. GOOD LUCK!
Sorry Jaymes, I couldn't help you. GOOD LUCK!
Answer
@Eastern yellowjacket solved. My docker environment was strange. I should have used node:slim simply.
Sorry Jaymes, I couldn't help you. GOOD LUCK!
Satin Angora
Hey what you mean by node: slim ?