internal server error when deploying to DigitalOcean

When entering some specific pages in my site, the server gets an error and shuts down. Why is this happening? I run it locally - everything works I run it on vercel - everything works But on DigitalOcean it breaks I have a loop of errors of this type:
TypeError: fetch failed
at node:internal/deps/undici/undici:12618:11
at async invokeRequest (/home/dor/project_name/node_modules/next/dist/server/lib/server-ipc/invoke-request.js:17:12)
at async invokeRender (/home/dor/project_name/node_modules/next/dist/server/lib/router-server.js:254:29)
at async handleRequest (/home/dor/project_name/node_modules/next/dist/server/lib/router-server.js:447:24)
at async requestHandler (/home/dor/project_name/node_modules/next/dist/server/lib/router-server.js:464:13)
at async Server.<anonymous> (/home/dor/project_name/node_modules/next/dist/server/lib/start-server.js:117:13) {
cause: SocketError: other side closed
at Socket.onSocketEnd (/home/dor/project_name/node_modules/next/dist/compiled/undici/index.js:1:63301)
at Socket.emit (node:events:530:35)
at endReadableNT (node:internal/streams/readable:1696:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'UND_ERR_SOCKET',
socket: {
localAddress: '::1',
localPort: 58042,
remoteAddress: '::1',
remotePort: 45019,
remoteFamily: 'IPv6',
timeout: undefined,
bytesWritten: 5873,
bytesRead: 12394
}
}
}
TypeError: fetch failed
at node:internal/deps/undici/undici:12618:11
at async invokeRequest (/home/dor/project_name/node_modules/next/dist/server/lib/server-ipc/invoke-request.js:17:12)
at async invokeRender (/home/dor/project_name/node_modules/next/dist/server/lib/router-server.js:254:29)
at async handleRequest (/home/dor/project_name/node_modules/next/dist/server/lib/router-server.js:447:24)
at async requestHandler (/home/dor/project_name/node_modules/next/dist/server/lib/router-server.js:464:13)
at async Server.<anonymous> (/home/dor/project_name/node_modules/next/dist/server/lib/start-server.js:117:13) {
cause: SocketError: other side closed
at Socket.onSocketEnd (/home/dor/project_name/node_modules/next/dist/compiled/undici/index.js:1:63301)
at Socket.emit (node:events:530:35)
at endReadableNT (node:internal/streams/readable:1696:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'UND_ERR_SOCKET',
socket: {
localAddress: '::1',
localPort: 58042,
remoteAddress: '::1',
remotePort: 45019,
remoteFamily: 'IPv6',
timeout: undefined,
bytesWritten: 5873,
bytesRead: 12394
}
}
}
`
D
Dor16d ago
Ok, this only happens when I try to display an image on a page that is NOT from the same origin URL But why does the server break though? I already configured my NextJS config: ``` images: { remotePatterns: [ { protocol: "https", hostname: "", }, { protocol: "http", hostname: "", }, ], },
D
Dor15d ago
This might be a next js version issue. Trying to follow this: https://medium.com/@pawanjotkaurbaweja/solved-typeerror-fetch-failed-4f7d304c0c68 Will update if it works
Medium
Solved!!!!!!!! — TypeError: fetch failed
at node:internal/deps/undici/undici:12345:11
D
Dor15d ago
after spending an entire day digging I gave up and went back to vercel what's the right way to allow loading images from any website then? keep in mind that this works both locally and on Vercel, and it works on DigitalOcean too but only on DigitalOcean the server randomly collapse
M
michaeldrotar14d ago
The hostname must be filled in The docs mention the other parts are optional and will default to ** but hostname is the most important part to list domains other than the current app's domain that you're optimizing images from (And ideally, all the fields should be filled in to be the most secure) https://nextjs.org/docs/app/api-reference/components/image#remotepatterns (There might be another issue cause I'm surprised it'd work on Vercel this way, but that's the most glaring one. You can also reference the deprecated domains config for more context.) I think the image format detection is more about new formats that aren't widely supported. Webp still doesn't work in IE and there might have been others when this feature was developed. Plus whatever the next hot new image format will be. Can find more info: https://nextjs.org/docs/app/building-your-application/optimizing/images
D
Dor14d ago
Ok I created a droplet on digital ocean again, but the problem persists. I fixed the remoetPatterns according to the next js docs. Why is this error happening? This is so random.
TypeError: fetch failed
at node:internal/deps/undici/undici:12618:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async invokeRequest (/home/dor/unpaack/node_modules/next/dist/server/lib/server-ipc/invoke-request.js:17:12)
at async invokeRender (/home/dor/unpaack/node_modules/next/dist/server/lib/router-server.js:254:29)
at async requestHandler (/home/dor/unpaack/node_modules/next/dist/server/lib/router-server.js:475:24)
at async Server.<anonymous> (/home/dor/unpaack/node_modules/next/dist/server/lib/start-server.js:117:13) {
cause: Error: connect ECONNREFUSED ::1:36529
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1605:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '::1',
port: 36529
}
}
TypeError: fetch failed
at node:internal/deps/undici/undici:12618:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async invokeRequest (/home/dor/unpaack/node_modules/next/dist/server/lib/server-ipc/invoke-request.js:17:12)
at async invokeRender (/home/dor/unpaack/node_modules/next/dist/server/lib/router-server.js:254:29)
at async requestHandler (/home/dor/unpaack/node_modules/next/dist/server/lib/router-server.js:475:24)
at async Server.<anonymous> (/home/dor/unpaack/node_modules/next/dist/server/lib/start-server.js:117:13) {
cause: Error: connect ECONNREFUSED ::1:36529
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1605:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '::1',
port: 36529
}
}
I have a website where users can upload images and I'm using cloudinary as my provider, which later I display with Image component from Next js When I enter some pages with some photos, the server collapse giving me the error above I guess, but I'm not attempting to make any connection I'm just trying to view a webpage
D
Dor14d ago
I'm not doing anything goofy :theowat: And it works perefctly when hosted on Vercel - https://unpaack.com Would you be kind to inspect this live with me?
Unpaack
Unpaack is where you discover the products used by the people you follow
D
Dor14d ago
i'm doomed
Want results from more Discord servers?
Add your server
More Posts
error: NEXT_REDIRECTI'm doing a server call in RSC, but it crash the app and show this kind of error and It shows in theNodejs take less time instead BunWhy they close this issue?? https://github.com/oven-sh/bun/issues/10519Testing in reactHey everyone, I’ve been pondering whether diving into learning how to test React code is worth it. DCreate t3 app with nextauth and new router problemsI have a question regarding the t3-createapp with nextauth. In what file do I put my <SessionProvidModals failing from tutorialhttps://github.com/mchisolm0/gallery/pull/2 I am having trouble getting the modals/app router workiBenefits of using auto incrementing primary keys?Is there any benefit of using auto incrementing columns as primary keys in postgres when I have anotIs Tanstack Query needed when using Next Route Handlers?Basically what it says. To my understanding a [Route Handler](https://nextjs.org/docs/app/building-yt3 env doesn't seem to work with docker compose buildI'm working to validate my application before pushing it to my CI/CD pipeline. I keep getting faileNextAuth - Email Provider Breaking Google Provider!Howdy, Some users of my app (app.getriver.io) started reporting not being able to log in to our appVSCode Import Autocomplete Purgatory (Relative, absolute, and barrel paths)I hope I'm missing some easy setting, otherwise this UI seems pretty terrible. Why does the autocompThe In App vs NextAuth problemIf you open the app link from a mobile app (like discord/telegram) and it opens in the in-app browseTypeErrorinitialTree is not iterable in Modern React Tutorial vidThe images map correctly until I try clicking on one, so I think the error may be misleading me. I T3 Roadmap? What would you recommend?I recently landed an internship, and they use the T3 Stack. I already had experience with JS, React,are there any better logs for nextJS that are in Englishjust spent 30min playing around with this and trying to work out the problem all I did was copy and Should I report a bug to a federal(-ish) university without hopes of a bug bounty?I live in nigeria, I attend national open university of nigeria. I recently found out a bug which alFork bombHi, i saw the new video from theo about the AI interview, and on the video he said to the AI to exeCommunication with server and client <nextjs>i have a webhook which calls nextjs api, can that api call do something which triggers an action onReact Native Data Loader libraryDoes anyone know of any good data loader libraries that will prevent waterfalls in React Native? I kNext.js as a client API choiceHaving watched all theo's videos regarding next and APIs (mainly tRPC and server actions), i got theShould I start my own blog, or use an existing platform?So I already have a few articles out on dev.to ( https://dev.to/noblica ) , and a few older ones on