Fetch failed with UND_ERR_CONNECT_TIMEOUT and ECONNRESET error on Next.js serverless function on Vercel Production env

After try the way in issue

Now I still meet same issue using @vercel/postgresin prod after add env VERCEL_UNDICI = 1 and redeploy.

Unhandled Rejection: NeonDbError: Error connecting to database: fetch failed at execute (/var/task/node_modules/@neondatabase/serverless/index.js:1548:25) at processTicksAndRejections (node:internal/process/task_queues:95:5) at runNextTicks (node:internal/process/task_queues:64:3) at process.processImmediate (node:internal/timers:454:9) at process.callbackTrampoline (node:internal/async_hooks:130:17) { severity: undefined, code: undefined, detail: undefined, hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: undefined, line: undefined, routine: undefined, sourceError: TypeError: fetch failed at node:internal/deps/undici/undici:13178:13 at processTicksAndRejections (node:internal/process/task_queues:95:5) at runNextTicks (node:internal/process/task_queues:64:3) at process.processImmediate (node:internal/timers:454:9) at process.callbackTrampoline (node:internal/async_hooks:130:17) at async execute (/var/task/node_modules/@neondatabase/serverless/index.js:1547:21) { [cause]: ConnectTimeoutError: Connect Timeout Error (attempted addresses: 100.26.116.133:443) at onConnectTimeout (node:internal/deps/undici/undici:2331:28) at node:internal/deps/undici/undici:2283:50 at Immediate._onImmediate (node:internal/deps/undici/undici:2315:13) at process.processImmediate (node:internal/timers:483:21) at process.callbackTrampoline (node:internal/async_hooks:130:17) { code: 'UND_ERR_CONNECT_TIMEOUT' } } } Node.js process exited with exit status: 128. The logs above can help with debugging the issue.
Unhandled Rejection: NeonDbError: Error connecting to database: fetch failed
    at execute (/var/task/node_modules/@neondatabase/serverless/index.js:1548:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  severity: undefined,
  code: undefined,
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: undefined,
  line: undefined,
  routine: undefined,
  sourceError: TypeError: fetch failed
      at /opt/rust/undici.js:40:5166
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async execute (/var/task/node_modules/@neondatabase/serverless/index.js:1547:21) {
    [cause]: Error: Client network socket disconnected before secure TLS connection was established
        at TLSSocket.onConnectEnd (node:_tls_wrap:1738:19)
        at TLSSocket.emit (node:events:531:35)
        at endReadableNT (node:internal/streams/readable:1696:12)
        at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
      code: 'ECONNRESET',
      path: undefined,
      host: 'api.us-east-1.aws.neon.tech',
      port: 443,
      localAddress: null
    }
  }
}
Deployment URL or Custom Domain:
Environment (local, preview, production):
Project Framework:
Build Settings:
  Framework Preset:
  Build Command (if not default):
  Output Directory (if not default):
  Install Command (if not default):
Node/Runtime Version:
Package Manager:
Relevant Packages:

Hi, @doodlesomething! Welcome to the Vercel Community :smile:

It would be helpful to get a minimal reproducible example for us to dig deeper on. Could you create one for us?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.