-
Hey 👋 I'm relatively new to the AWS ecosystem, so please bear with my questions. ContextI'm writing a Lambda function using Node.js 18.x and invoking the function from a Golang application. Lambda code:
Golang code
The problem I'm facingWhen the Lambda code fails, e.g., throws an unhandled exception, I don't receive an err. However, I do:
Although I understand that the SDK API makes sense here because the Lambda execution succeeds (just with an exception), I find it confusing. I expect the abstraction layer above this to behave differently, especially in Go, where you would anticipate a function to return an error if it fails. Proposed SolutionA few things that I can think of:
Questions
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @asafshen , Thanks for posting the question and sorry about the slow response time. You have understood correctly how the Invoke lambda response works. A successful invocation would mean that the Lambda executed successfully, regardless of what you send back from that lambda itself whether it be an error or an exception.
I understand the confusion, however
I think your error handling assumption is good. You can follow this Node.js AWS Lambda error handling doc for more info about error handling from a lambda context. Let me know if you have any questions, Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Hi @asafshen ,
Thanks for posting the question and sorry about the slow response time.
You have understood correctly how the Invoke lambda response works. A successful invocation would mean that the Lambda executed successfully, regardless of what you send back from that lambda itself whether it be an error or an exception.
I understand the confusion, however
err
will only get populated if the Lambda API server fails to invoke your function.In other words, errors on lambda are application level errors, whereas errors thrown in the SDK …