You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The python lambda times out if an unhandled error occurs (for example a runtime exception), the expected behaviour is to terminate the funtion and when the lambda is invoked to populate the FunctionError of the response with the error. However no information about the unhandled error is shown and the lambda continues to execute until a timeout. After some digging the problems seems to come from the invoke.py file in src/lambda/handler-runner/python-runner. Another thing to consider is that if an error occur during the imports (before the handler lambda is invoked) this also results in a time out, but should yield an error send again to the FunctionError.
Current Behavior
The python lambda times out if an unhandled error occurs instead of terminating.
After encountering unhandled exception the lambda should be terminated and immediate response should be returned with the error encountered.
Environment
serverless version: v3.39.0
serverless-offline version: v14.0.0
python version: v3.11
OS: macOS 14.6.1
Possible Solution
Use a try-except block to handle the error that is thrown and return the information using the sys.stdout.write() with argument which contains __offline_payload__ with information about the error as JSON and status_code set to 500 for example.
Additional context/Screenshots
The text was updated successfully, but these errors were encountered:
Bug Report
The python lambda times out if an unhandled error occurs (for example a runtime exception), the expected behaviour is to terminate the funtion and when the lambda is invoked to populate the
FunctionError
of the response with the error. However no information about the unhandled error is shown and the lambda continues to execute until a timeout. After some digging the problems seems to come from theinvoke.py
file insrc/lambda/handler-runner/python-runner
. Another thing to consider is that if an error occur during the imports (before the handler lambda is invoked) this also results in a time out, but should yield an error send again to theFunctionError
.Current Behavior
The python lambda times out if an unhandled error occurs instead of terminating.
Sample Code
Expected behavior/code
After encountering unhandled exception the lambda should be terminated and immediate response should be returned with the error encountered.
Environment
serverless
version: v3.39.0serverless-offline
version: v14.0.0python
version: v3.11OS
: macOS 14.6.1Possible Solution
Use a try-except block to handle the error that is thrown and return the information using the
sys.stdout.write()
with argument which contains__offline_payload__
with information about the error as JSON andstatus_code
set to 500 for example.Additional context/Screenshots
The text was updated successfully, but these errors were encountered: