Next.js Discord

Discord Forum

How do I see which image fails with next-image?

Unanswered
Irish Red and White Setter posted this in #help-forum
Open in Discord
Irish Red and White SetterOP
We have a site with thousands of pages.

When rendering some of them, next-image (we're guessing, since it's image-optimizer.js in this mix) throws a ECONNREFUSED error when using fetch:

2024-08-14T13:21:25.4178845Z TypeError: fetch failed
2024-08-14T13:21:25.4179525Z     at node:internal/deps/undici/undici:13178:13
2024-08-14T13:21:25.4179577Z     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-08-14T13:21:25.4179616Z     at async imageOptimizer (/app/node_modules/next/dist/server/image-optimizer.js:233:29)
2024-08-14T13:21:25.4179662Z     at async /app/node_modules/next/dist/server/next-server.js:157:72
2024-08-14T13:21:25.4179698Z     at async /app/node_modules/next/dist/server/response-cache.js:69:36 {
2024-08-14T13:21:25.4179736Z   [cause]: AggregateError [ECONNREFUSED]: 
2024-08-14T13:21:25.4179772Z       at internalConnectMultiple (node:net:1118:18)
2024-08-14T13:21:25.4179832Z       at afterConnectMultiple (node:net:1685:7)
2024-08-14T13:21:25.4179870Z       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
2024-08-14T13:21:25.4179906Z     code: 'ECONNREFUSED',
2024-08-14T13:21:25.4179944Z     [errors]: [ [Error], [Error] ]
2024-08-14T13:21:25.4179975Z   }
2024-08-14T13:21:25.4180006Z }


Is there any way to figure out where/when this is caused?
We have thousands of images working on this site, it's a needle in a haystack without anything more to go one. How can we pinpoint this error?

The error above is from the docker container running nextjs.

0 Replies