Next.js Discord

Discord Forum

[SOLVED] Redirect Error in Server Action on Docker (fetch failed)

Answered
Chien Français Tricolore posted this in #help-forum
Open in Discord
Avatar
Chien Français TricoloreOP
I have a server action that does a redirect (next/navigation)

It works successefully if I look at the browser(the user is successfully redirected), but in the server I get this console logged:

| failed to get redirect response TypeError: fetch failed
web | at node:internal/deps/undici/undici:13737:13
web | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
web | at async globalThis.fetch (/app/.next/server/chunks/137.js:11:171105)
web | at async rm (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:15:4292)
web | at async rg (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:741)
web | at async rz (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:24709)
web | at async doRender (/app/node_modules/next/dist/server/base-server.js:1394:30)
web | at async cacheEntry.responseCache.get.routeKind (/app/node_modules/next/dist/server/base-server.js:1555:28)
web | at async NextNodeServer.renderToResponseWithComponentsImpl (/app/node_modules/next/dist/server/base-server.js:1463:28)
web | at async NextNodeServer.renderPageComponent (/app/node_modules/next/dist/server/base-server.js:1856:24) {
web | [cause]: Error: connect ECONNREFUSED 127.0.0.1:80
web | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1605:16)
web | at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
web | errno: -111,
web | code: 'ECONNREFUSED',
web | syscall: 'connect',
web | address: '127.0.0.1',
web | port: 80
web | }
web | }

It's all deployed inside a docker, which also contains nginx. I hope this isn't causing any trouble.
Answered by Chien Français Tricolore
Omg i am so happy. I think last canary version fixed this
View full answer

14 Replies

Avatar
Clown
What next version? Also any fetch calls? Especially fetch your own api?
Avatar
Chien Français TricoloreOP
No fetch calls at all, it just uses cookies().delete() too, which also is working successfully

The next version is 14.1.0
Avatar
Chien Français TricoloreOP
I just wish I understood why its trying to connect to something on Port 80 since nextjs is running on port 3000 -_-
Avatar
Clown
Your http server runs on port 80
Maybe its related to not using https or something. Im not 100% sure
Avatar
Chien Français TricoloreOP
But what is it trying to connect to?
shouldn't it just give the response and thats it?
Avatar
Chien Français TricoloreOP
this is the comment in the source code in the place the error is thrown
Image
Avatar
Chien Français TricoloreOP
Omg i am so happy. I think last canary version fixed this
Answer
Avatar
Chien Français TricoloreOP
I will be using canary version for now
Avatar
Chien Français TricoloreOP
Hmmm, actually it only fixed in 1 out of 2 cases 🤔 weird
better than nothing i guess
NVM the other case was literally my fault
so its all fixed now 💯 🔥 :ultrafast_parrot:
:egp_giveaway: :egp_giveaway: :egp_giveaway: