I have written a NodeJS lambda function and I am testing it locally with sam local
. I have noticed the browser takes much more time to download it than I can see the lambda execution from the logs. Chrome shows that it waited 6,13 seconds before the server responded.
2020-02-04 21:02:18 127.0.0.1 - - [04/Feb/2020 21:02:18] "GET /v1/verify/Yk6QwCF1 HTTP/1.1" 502 -
Invoking src/handlers/users/verifyUser.handler (nodejs10.x)
Fetching lambci/lambda:nodejs10.x Docker container image......
Mounting C:\dev\mezinamiridici\infrastructure as /var/task:ro,delegated inside runtime container
?[32mREPORT RequestId: 56060b6c-2bef-1241-03a4-fb2fca321096 Init Duration: 2238.80 ms
Duration: 127.36 ms Billed Duration: 200 ms Memory Size: 128 MB Max Memory Used: 59 MB ?[0m
2020-02-04 21:03:10 127.0.0.1 - - [04/Feb/2020 21:03:10] "GET /v1/verify/Yk6QwCF1 HTTP/1.1" 403 -
It should be some 2,5 seconds. Where are the remaining almost 4 seconds spent?
The source code is there: https://github.com/literakl/mezinamiridici/blob/master/infrastructure/src/handlers/users/verifyUser.js