When your function returns to the caller, the Lambda service freezes the execution environment and nothing happens there until there is another invocation, or until the execution environment is shutdown.
If you look at your trace you see that the last log message is printed after the END message. My assumption is that because you are using Node.js, the event loop is not empty when you return. This external blog explains it very well. The following documentation explains how to use
callbackWaitsForEmptyEventLoop to resolve this.
Errors with nodejs lambda docker imageasked 3 months ago
My Lambda function is not getting invoked all of a sudden.asked 6 months ago
Lambda log entries intermittently taking 1 hour+ to arrive in CloudwatchAccepted Answerasked a month ago
Cloudwatch - console.log vs console.dir (nodejs lambda)asked 3 months ago
sqs event triggers lambda directly, is there a way to delay that execution by 10-20 seconds?Accepted Answerasked 2 years ago
AWS Lambda Function Triggers on S3 Event, But only Once in About 30 Minsasked 3 years ago
How to add custom userUUD when logging aws Lambda Functionasked a month ago
Can I use CloudWatch Logs to trigger a Lambda function?Accepted Answerasked 2 years ago
Lambda to Dynamo Write: Intermittently missing batch dataasked 6 months ago
Trigger cloudwatch event from lambdaAccepted Answerasked 6 months ago