Vercel Serverless function with nuxtjs ECONNRESET Client network socket disconnected before secure TLS connection was established

Viewed 676

so i'm having this problem on a nuxt implementation with vercel, at random moments the site doesn't load and throws a 502 http error this is the stacktrace of vercel:

ERROR   Unhandled Promise Rejection     {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"FetchError: request to {api_url} failed, reason: Client network socket disconnected before secure TLS connection was established","reason":{"errorType":"FetchError","errorMessage":"request to {api_url} failed, reason: Client network socket disconnected before secure TLS connection was established","code":"ECONNRESET","message":"request to {api_url} failed, reason: Client network socket disconnected before secure TLS connection was established","type":"system","errno":"ECONNRESET","stack":["FetchError: request to {api_url} failed, reason: Client network socket disconnected before secure TLS connection was established","    at ClientRequest.<anonymous> (server.js:16011:11)","    at ClientRequest.emit (events.js:315:20)","    at ClientRequest.EventEmitter.emit (domain.js:483:12)","    at TLSSocket.socketErrorListener (_http_client.js:426:9)","    at TLSSocket.emit (events.js:315:20)","    at TLSSocket.EventEmitter.emit (domain.js:483:12)","    at emitErrorNT (internal/streams/destroy.js:92:8)","    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)","    at processTicksAndRejections (internal/process/task_queues.js:84:21)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: FetchError: request to {api_url} failed, reason: Client network socket disconnected before secure TLS connection was established","    at process.<anonymous> (/var/runtime/index.js:35:15)","    at process.emit (events.js:327:22)","    at process.EventEmitter.emit (domain.js:483:12)","    at processEmit [as emit] (/var/task/node_modules/signal-exit/index.js:161:32)","    at processPromiseRejections (internal/process/promises.js:209:33)","    at processTicksAndRejections (internal/process/task_queues.js:98:32)"]}
    Unknown application error occurred

So the error it's about a connection with the api, for what i found this is a Node error but my api is developed on Laravel so i'm really lost Thanks for the help

1 Answers

I ran into this issue (with a Next.js project on Vercel) and fixed it. I was calling an external API but forgot to await one of the handlers, so the Lambda eventually stopped waiting for the API call response once my code finished running.

Related