All my lambdas with callbacks deployed by serverless when invoked have durations around 5960ms. (Lambda timeout set to 6 seconds… peculiar)
The same code written in the AWS lambda inline editor, has the normal duration 100ms etc.
This is only if module.exports.handler has a callback and is not async.
So I’m just converting my handler functions to async which I should have already done.
Has anyone else experienced this? Not too worried about getting this resolved, just curious.
Hmm… I don’t see any issues.
To confirm I went ahead and whipped up a simple service with your code and it’s returning as expected:
First invocation: REPORT RequestId: 4b88f946-3c65-4ba6-aaca-8a27bff70320 Duration: 128.67 ms Billed Duration: 200 ms Memory Size: 1024 MB Max Memory Used: 77 MB Init Duration: 205.88 ms
Subsequent invocations:
REPORT RequestId: 95f041dd-6a19-40c3-9e65-d1153c8b422a Duration: 27.90 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 77 MB
REPORT RequestId: 4d607472-2e11-40ec-8ce7-bf6423f95411 Duration: 27.52 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 77 MB
REPORT RequestId: d0348c35-c8f3-4fad-a071-409c4e030b9b Duration: 27.25 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 77 MB