Мы используем AWS Lambda для вызова наших API. Недавно мы обновили нашу версию Lambda Node с 8.10 до версии Node 10.x. Мы добавили событие процесса для необработанного отклонения, а также написали код в блоке try-catch, но ни один из кодов не решил нашу проблему. Пожалуйста, найдите блок ошибок, который мы получаем, когда мы запускаем API через Lambda.
Обратите внимание, что мы используем пакет запроса-обещания NPM для запроса.
Пробный код с Try catch и processingнеобработанное событие с использованием Process.event
{
"errorType": "Runtime.UnhandledPromiseRejection",
"errorMessage": "RequestError: Error: Client network socket disconnected before secure TLS connection was established",
"stack": [
"Runtime.UnhandledPromiseRejection: RequestError: Error: Client network socket disconnected before secure TLS connection was established",
" at process.on (/var/runtime/index.js:37:15)",
" at process.emit (events.js:203:15)",
" at process.EventEmitter.emit (domain.js:448:20)",
" at /var/task/node_modules/bluebird/js/release/debuggability.js:199:33",
" at activeFireEvent (/var/task/node_modules/bluebird/js/release/debuggability.js:242:44)",
" at fireRejectionEvent (/var/task/node_modules/bluebird/js/release/debuggability.js:632:14)",
" at Promise._notifyUnhandledRejection (/var/task/node_modules/bluebird/js/release/debuggability.js:65:9)",
" at Timeout._onTimeout (/var/task/node_modules/bluebird/js/release/debuggability.js:44:14)",
" at ontimeout (timers.js:436:11)",
" at tryOnTimeout (timers.js:300:5)",
" at listOnTimeout (timers.js:263:5)",
" at Timer.processTimers (timers.js:223:10)"
],
"reason": {
"errorType": "RequestError",
"errorMessage": "Error: Client network socket disconnected before secure TLS connection was established",
"stack": [
"RequestError: Error: Client network socket disconnected before secure TLS connection was established",
" at new RequestError (/var/task/node_modules/request-promise-core/lib/errors.js:14:15)",
" at Request.plumbing.callback (/var/task/node_modules/request-promise-core/lib/plumbing.js:87:29)",
" at Request.RP$callback [as _callback] (/var/task/node_modules/request-promise-core/lib/plumbing.js:46:31)",
" at self.callback (/var/task/node_modules/request/request.js:185:22)",
" at Request.emit (events.js:198:13)",
" at Request.EventEmitter.emit (domain.js:448:20)",
" at Request.onRequestError (/var/task/node_modules/request/request.js:881:8)",
" at ClientRequest.emit (events.js:198:13)",
" at ClientRequest.EventEmitter.emit (domain.js:448:20)",
" at TLSSocket.socketErrorListener (_http_client.js:392:9)",
" at TLSSocket.emit (events.js:198:13)",
" at TLSSocket.EventEmitter.emit (domain.js:448:20)",
" at emitErrorNT (internal/streams/destroy.js:91:8)",
" at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)",
" at process._tickCallback (internal/process/next_tick.js:63:19)"
],
}
}