lambdr
lambdr copied to clipboard
Include stacktrace in error bodies
AWS Lambda error endpoints (both the initialisation error endpoint and the invocation error endpoint) expect a content type "application/vnd.aws.lambda.error+json" with the following body:
{
"errorMessage": "...",
"errorType": "...",
"stackTrace": [],
}
The post_lambda_error
function is responsible for formatting errors and POST
ing them to the endpoint. However, it currently passes an empty stacktrace. The stackTrace must be a list of strings (character vector).
Simply including the call stack in a tryCatch
block is insufficient here, as it won't capture the detail of the call stack in the "try block". The try_capture_stack
from the evaluate
package might be useful here (if I can work out how to use it).
Including these stacktraces will complicate the unit testing, as the stack will include a substantial depth of function calls made by testthat
. Perhaps we can trim those somehow?