I have a function which has some delays and database connections that must be opened. Also, depending on the status, the function, may need to wait for some time before it can continue. How do I insure that my function is allowed to run for up to 45 seconds or more before AWS times out the task?
What language/runtime are you using?
In NodeJS, the
context.callbackWaitsForEmptyEventLoop property defaults to
true so that Lambda will wait (up until the function’s configured timeout value) for outstanding callbacks to return. I’m not sure about other runtimes.
@jdheeter are you asking how to set the timeout for a Lambda function? There’s a
timeout property you can set for the function in
serverless.yml. It doesn’t seem to be in the documentation but checkout out the source.
functions: hello: handler: handler.hello timeout: 45
Thanks for the clarification!