alexcasalboni / aws-lambda-power-tuning

AWS Lambda Power Tuning is an open-source tool that can help you visualize and fine-tune the memory/power configuration of Lambda functions. It runs in your own AWS account - powered by AWS Step Functions - and it supports three optimization strategies: cost, speed, and balanced.
Apache License 2.0
5.4k stars 372 forks source link

Show error message and type on function invocation errors #247

Closed andrestoll closed 5 months ago

andrestoll commented 5 months ago

Error type, message and trace will be shown for function invocation errors. Also when happens for pre or post processing.

Examples for executor function response

original function response:

{
    "StatusCode": 200,
    "FunctionError": "Unhandled",
    "ExecutedVersion": "$LATEST"
    "Payload": {"errorMessage": "Exception raised during execution.", "errorType": "Exception", "requestId": "c99e0a50-3b11-4c1a-aa20-108339da181b", "stackTrace": ["  File \"/var/task/lambda_function.py\", line 9, in lambda_handler\n    raise Exception(\"Exception raised during execution.\")\n"]}
}
{
  "errorType": "Error",
  "errorMessage": "Invocation error (running in series) with payload \"null\" - original error type: \"undefined\", original error message: \"2024-04-29T15:49:41.111Z 29faf2b8-bbed-49ed-8df8-31cfb63a73a5 Task timed out after 3.00 seconds\", trace: \"undefined\"",
  "trace": [
    "Error: Invocation error (running in series) with payload \"null\" - original error type: \"undefined\", original error message: \"2024-04-29T15:49:41.111Z 29faf2b8-bbed-49ed-8df8-31cfb63a73a5 Task timed out after 3.00 seconds\", trace: \"undefined\"",
    "    at handleLambdaInvocationError (/var/task/executor.js:177:11)",
    "    at runInSeries (/var/task/executor.js:160:13)",
    "    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
    "    at async module.exports.handler (/var/task/executor.js:66:19)"
  ]
}

original func response:

{
    "StatusCode": 200,
    "FunctionError": "Unhandled",
    "ExecutedVersion": "$LATEST"
    "Payload": {"errorMessage":"2024-04-29T15:53:04.314Z 9fb99af1-d955-4c09-9e72-8e70756c327f Task timed out after 3.01 seconds"}
}