I have an error on my 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
I was wondering how do I view the errorMessage [object Object]
?
I hope it's not too late. I had the same issue and I solved it by following this instruction from the following link:
"You must turn the myErrorObj object into a JSON string before calling callback to exit the function. Otherwise, the myErrorObj is returned as a string of "[object Object]"."
I simply passing the "error" object as JSON.stringify(error) solved the problem in my case.