Skip to content

API Gateway timeoutInMillis #651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
danhnguyeen opened this issue May 16, 2025 · 1 comment
Open

API Gateway timeoutInMillis #651

danhnguyeen opened this issue May 16, 2025 · 1 comment

Comments

@danhnguyeen
Copy link

Hello there,
I would like to change the timeout for API Gateway integration.
In serverless, I can change this by setting the timeoutInMillis property in the apiGateway configuration.

provider:
  apiGateway:
    timeoutInMillis: 10000 # Default timeout of 10 seconds for all endpoints
functions:
  fetch:
    handler: handler.hello
    events:
      - http:
          path: /posts/{id}
          method: get
  create:
    handler: handler.bye
    events:
      - http:
          path: /posts
          method: post
          timeoutInMillis: 40000 #

But it seems this configuration doesn't work with Step Functions.
In Step Functions, I tried to change like this but it didn't work.

name: hello
type: EXPRESS
events:
  - http:
      path: /hello
      method: GET
      cors: true
      action: StartSyncExecution
      timeoutInMillis: 119000

Could you please help me on this? Of course, I can change it directly on the API Gateway console. But it’s not a best practice.
Thanks a lot

@zirkelc
Copy link
Collaborator

zirkelc commented May 17, 2025

Hi @danhnguyeen

this is a new feature of Serverless Framework and not yet supported by this plugin.
This PR implemented it: serverless/serverless#12800

I'm currently a bit short on time, so feel free to submit a PR for this. As a template, take a look at how API keys are handled:
https://github.com/serverless-operations/serverless-step-functions/blob/63abc6055ff69311bd8828383df04a226d19028a/lib/deploy/events/apiGateway/apiKeys.js

This finds the provider.apiGateway.apiKey property and adds it to the template. We would need the same for provider.apiGateway. timeoutInMillis. For the timeoutInMillis on the individual events, we would need to add a section to this function: https://github.com/serverless-operations/serverless-step-functions/blob/63abc6055ff69311bd8828383df04a226d19028a/lib/deploy/events/apiGateway/validate.js

Let me know if you want to start working on this, otherwise I will come back later (not sure when).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants