Saasli / saasli-backend

Documentation
https://saasli.github.io/docs/
0 stars 0 forks source link

Timeout on first usage of an endpoint #19

Open godd9170 opened 8 years ago

godd9170 commented 8 years ago

It seems like the first time I try and hit an endpoint after its been recently deployed it will sometimes timeout and return:

{
  "errorMessage": "2016-09-13T20:55:06.065Z 55d0d7fb-79f4-11e6-842b-f5f9363f7916 Task timed out after 6.00 seconds"
}

I don't know if this is my fault, expected Lambda behaviour or what's happening, but it needs to be addressed.

godd9170 commented 8 years ago

This is a product of a phenomenon known as the 'Cold Start' https://forums.aws.amazon.com/thread.jspa?threadID=181348

It's the result of the function code residing outside of the cache until it's run.

godd9170 commented 8 years ago

http://stackoverflow.com/questions/37931010/lambda-cold-start-possible-solution

godd9170 commented 7 years ago

So, like it or not, Serverless actually lets you set the timeout in the .yml

functions:
  event:
    timeout: 15
    handler: handler.event
    events:
      - http:
          method: post
          path: event
  events:
    handler: handler.events

maybe we'll just do this?