'AWS Lambda - serverless - try/catch?
My setup looks like:
export const someAWSLambaJob: AWSLambda.Handler<ScheduledEvent> = async () => {
try {
await loadSome();
await loadSomeMore();
console.log('success');
} catch (e) {
console.log('failure');
await axios.post(url, `something went wrong ${e.message}`);
}
};
Problem is: When loadSome()or loadSomeMore() throw an error, it seem like in AWS Lambda execution it doesn't even and up in the catch here. The job is immediately cancelled. Also, when putting some console.log() in there, it doesn't show up which it should viewing the cloudLogs on the dashboard.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
