2

Is it possible to set a custom request integration timeout in AWS API Gateway in serverless.yml configuration?

Although the question is quite straight forward I find a little of context always useful:

I need to notify the final user when the lambda function has timed out. Such situation could happen due to project requirements (lambda is communicating with third-party systems that may not be up). I came up with some other solutions, I believe setting the API-GW request timeout to the same time as lambda timeout is the best one, though.

5
  • Do you ask, how to set specific timeout for APIGW endpoint? Or do you ask how to notify user that you're unable to fulfill request, before actually timeout takes place? Commented Nov 25, 2019 at 10:13
  • @MariuszNowak I ask how to set a specific timeout for APIGW endpoint :) Commented Nov 25, 2019 at 12:34
  • 1
    Unfortunately there's no out of a box supported for that in Serverless Framework. Still please post a request, also PR is very welcome Commented Nov 27, 2019 at 12:24
  • @MariuszNowak Thanks for the answer :) Commented Nov 27, 2019 at 13:54
  • 1
    For now using AWS CLI is the best bet to manually update the integration timeout. This is what we used to solve our issue manually. aws apigatewayv2 update-integration --integration-id <integration-id> --api-id <api id> --timeout-in-millis <time in milliseconds> Commented Mar 9, 2020 at 4:30

1 Answer 1

3

Realised that with the recent update in serverless framework - function timeout is respected across the integration. All you have to do is pass timeout value in your function.

Here is an example:

functions: myfunction: handler: public/index.php timeout: 15 #This will be same for integration timeout in API Gateway. tags: project: myproject

Sign up to request clarification or add additional context in comments.

1 Comment

Note that this only applies if you use the HTTP API integration. It doesn't apply for the REST API integration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.