amazon-web-servicesaws-lambdachalice

set timeout for chalice functions in general


In the documentation of chalice one can see an example of a configuration of a lambda function on aws provisioned by chalice.

The idea is that you can define an app like below:

from chalice import Chalice

app = Chalice(app_name='demotimeout')


@app.route('/')
def index():
    return {'hello': 'world'}

@app.lambda_function()
def test_lambda(event, context):
    return {'hello': 'world'}

And with this app you can set the config.json file like so;

{
  "stages": {
    "dev": {
      "api_gateway_stage": "api",
      "lambda_functions": {
        "test_lambda": {
          "lambda_timeout": 120
        }
      }
    }
  },
  "version": "2.0",
  "app_name": "demotimeout"
}

When you do this, you set the timeout for the test_lambda function.

I was wondering, is it possible to set the timeout of the index function? The one that does not have the @app.lambda_function() decorator but the one that has the @app.route('/') decorator?


Solution

  • If the requirements aren't met when it hits the route in Chalice, it will either fail or pass. There is not a timeout setting in Chalice routing.

    There is however a timeout setting in Chalice for the lambdas which an be set in the config.