I’m using lambda where I deployed the app. I’m calling the data API from it. Sometimes, the API works fine and sometimes it won’t.
following it the error I can see in CloudWatch
. I’m using the axios
to call the Mongo data api.
@logStream
2023/10/31/[$LATEST]
@message
2023-10-31T13:50:26.423Z INFO mongoQuery Error: AxiosError: Client network socket disconnected before secure TLS connection was established
at Function.AxiosError.from (/build/index.js:2143:53)
at RedirectableRequest.<anonymous> (/build/index.js:3203:33)
at RedirectableRequest.emit (node:events:529:35)
at ClientRequest.eventHandlers.<computed> (/node_modules/follow-redirects/index.js:14:24)
at ClientRequest.emit (node:events:517:28)
at TLSSocket.socketErrorListener (node:_http_client:501:9)
at TLSSocket.emit (node:events:517:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at processTicksAndRejections (node:internal/process/task_queues:82:21) {
localAddress: undefined,
port: 443,
host: 'us-east-1.aws.data.mongodb-api.com',
path: null,
code: 'ECONNRESET',
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: 'http',
transformRequest: [ [Function (anonymous)] ],
transformResponse: [ [Function (anonymous)] ],
timeout: 100000,
.......
......
_currentUrl: 'https://************/endpoint/data/v1/action/find',
_timeout: null,
[Symbol(kCapture)]: false
},
cause: Error: Client network socket disconnected before secure TLS connection was established
at connResetException (node:internal/errors:720:14)
at TLSSocket.onConnectEnd (node:_tls_wrap:1655:19)
at TLSSocket.emit (node:events:529:35)
at endReadableNT (node:internal/streams/readable:1368:12)
at processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'ECONNRESET',
path: null,
host: 'us-east-1.aws.data.mongodb-api.com',
port: 443,
localAddress: undefined
}
}
Anyone please guide the different solutions or just a hint where might be issue?