1 Answer
- Newest
- Most votes
- Most comments
0
Take a look at the Example app.py in this tutorial - https://docs.aws.amazon.com/lambda/latest/dg/services-rds-tutorial.html for sample code in Python.
This example is specific to RDS, but you will need to apply the same principle to Redis.
Note how a sys.exit() is called if the connection code results in an exception. It makes no sense to keep the lambda instance alive if the connection could not even be established. Then that particular lambda instance will keep receiving new events and they will all fail. It is better to start a new lambda instance with a new event, just in case it is able to establish the connection and process new events.
Relevant content
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
Thank you for your answer,
my code is in nodeJs not in python, so I did process.exit(); instead of sys.exit() but the lambda still fail and no custom error returned