如何在 AWS Lambda Node js 中查看对象错误
How do I view object error in AWS Lambda Node js
我的 AWS Lambda 出错。
{
"errorType": "object",
"errorMessage": "[object Object]",
"trace": []
}
Function Logs
START RequestId: 9759e0c5-3ac7-494b-8970-d19b01981b32 Version: $LATEST
2021-07-16T08:46:51.907Z 9759e0c5-3ac7-494b-8970-d19b01981b32 ERROR Invoke Error {"errorType":"Error","errorMessage":"[object Object]","stack":["Error: [object Object]"," at _homogeneousError (/var/runtime/CallbackContext.js:12:12)"," at postError (/var/runtime/CallbackContext.js:29:54)"," at done (/var/runtime/CallbackContext.js:56:7)"," at fail (/var/runtime/CallbackContext.js:68:7)"," at /var/runtime/CallbackContext.js:104:16"," at processTicksAndRejections (internal/process/task_queues.js:95:5)"]}
END RequestId: 9759e0c5-3ac7-494b-8970-d19b01981b32
REPORT RequestId: 9759e0c5-3ac7-494b-8970-d19b01981b32 Duration: 335.31 ms Billed Duration: 336 ms Memory Size: 128 MB Max Memory Used: 69 MB Init Duration: 157.54 ms
我想知道如何查看错误消息 [object Object]
?
希望还不算太晚。我遇到了同样的问题,我按照以下 link:
中的说明解决了这个问题
"在调用回调退出函数之前,必须将 myErrorObj 对象转换为 JSON 字符串。否则,myErrorObj 将作为 "[object Object]" 的字符串返回。"
我只是将“错误”对象作为 JSON.stringify(error) 传递解决了我的问题。
希望对您有所帮助。
此致
我的 AWS Lambda 出错。
{
"errorType": "object",
"errorMessage": "[object Object]",
"trace": []
}
Function Logs
START RequestId: 9759e0c5-3ac7-494b-8970-d19b01981b32 Version: $LATEST
2021-07-16T08:46:51.907Z 9759e0c5-3ac7-494b-8970-d19b01981b32 ERROR Invoke Error {"errorType":"Error","errorMessage":"[object Object]","stack":["Error: [object Object]"," at _homogeneousError (/var/runtime/CallbackContext.js:12:12)"," at postError (/var/runtime/CallbackContext.js:29:54)"," at done (/var/runtime/CallbackContext.js:56:7)"," at fail (/var/runtime/CallbackContext.js:68:7)"," at /var/runtime/CallbackContext.js:104:16"," at processTicksAndRejections (internal/process/task_queues.js:95:5)"]}
END RequestId: 9759e0c5-3ac7-494b-8970-d19b01981b32
REPORT RequestId: 9759e0c5-3ac7-494b-8970-d19b01981b32 Duration: 335.31 ms Billed Duration: 336 ms Memory Size: 128 MB Max Memory Used: 69 MB Init Duration: 157.54 ms
我想知道如何查看错误消息 [object Object]
?
希望还不算太晚。我遇到了同样的问题,我按照以下 link:
中的说明解决了这个问题"在调用回调退出函数之前,必须将 myErrorObj 对象转换为 JSON 字符串。否则,myErrorObj 将作为 "[object Object]" 的字符串返回。"
我只是将“错误”对象作为 JSON.stringify(error) 传递解决了我的问题。
希望对您有所帮助。
此致