Skip to content

API Gateway timeoutInMillis #651

@danhnguyeen

Description

@danhnguyeen

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

Activity

zirkelc

zirkelc commented on May 17, 2025

@zirkelc
Collaborator

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @zirkelc@danhnguyeen

        Issue actions

          API Gateway timeoutInMillis · Issue #651 · serverless-operations/serverless-step-functions