Next.js Discord

Discord Forum

Lots of fetch failed errors (UND_ERR_CONNECT_TIMEOUT)

Answered
Large oak-apple gall posted this in #help-forum
Open in Discord
Avatar
Large oak-apple gallOP
In server logs I get many errors about fetch failed. Absolute vast majority of errors are completely identical and look like following. No info of what it is trying to fetch and from where, stack trace ends before any of my files
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11730:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
    cause: ConnectTimeoutError: Connect Timeout Error
        at onConnectTimeout (node:internal/deps/undici/undici:6869:28)
        at node:internal/deps/undici/undici:6825:50
        at Immediate._onImmediate (node:internal/deps/undici/undici:6857:13)
        at process.processImmediate (node:internal/timers:478:21)
        at process.callbackTrampoline (node:internal/async_hooks:130:17) {
        code: 'UND_ERR_CONNECT_TIMEOUT'
      }
  }

And very few (2 occurrences in past 1000 lines of error logs) look like this. I never wrote any socket in this project
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11730:11)
    at async globalThis.fetch (<path to project>/.next/server/chunks/702.js:1:36426)
    at async n (<path to project>/.next/server/chunks/793.js:8:22245)
    at async Promise.all (index 3)
    at async q (<path to project>/.next/server/<path to certain page>/page.js:1:3239) {
    cause: SocketError: other side closed
        at Socket.onSocketEnd (node:internal/deps/undici/undici:8280:26)
        at Socket.emit (node:events:526:35)
        at endReadableNT (node:internal/streams/readable:1589:12)
        at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
        code: 'UND_ERR_SOCKET',
        socket: {
            localAddress: '::1',
            localPort: 53330,
            remoteAddress: undefined,
            remotePort: undefined,
            remoteFamily: undefined,
            timeout: undefined,
            bytesWritten: 557,
            bytesRead: 713
          }
      }
  }
Answered by Large oak-apple gall
I fixed it. For future reference - it was axiom package that did something wrong and kept spamming errors. I erased it from project, errors gone
View full answer

8 Replies

Avatar
Jesse677
Can we see the code doing the fetching
@Large oak-apple gall
Avatar
Large oak-apple gallOP
Of course not. I have no idea what it might be and where it is located. If I knew that, I would have included it
Avatar
Jesse677
Well that's not really helpful if we don't have any code
Try #gpt-help
Avatar
Large oak-apple gallOP
I fixed it. For future reference - it was axiom package that did something wrong and kept spamming errors. I erased it from project, errors gone
Answer
Avatar
Jesse677
Nice
Remember to mark as answered