Skip to content

Feature request: Request to add "InvokeMode: RESPONSE_STREAM" support for SAM "Api" events to enable Lambda response streaming through API Gateway. #8606

Closed

Description

@ajaypokale

AWS Lambda and API Gateway support response streaming as documented in the AWS blog post
https://aws.amazon.com/blogs/compute/building-responsive-apis-with-amazon-api-gateway-response-streaming/

However, this feature is not available through SAM "Api" events

I wish sam cli should support InvokeMode: RESPONSE_STREAM
The cloud formation and cli is already supporting this property.

Code not working:

`
  ApiHandlerFun:
    Type: AWS::Serverless::Function
    Properties:
              CodeUri: apis-lambda/src
      Handler: ApiHandlerLambda.lambda_handler
      FunctionName: !Sub "${Stage}-ApiHandlerFun"
      Environment:
        Variables:
          AGENT_ID: !Ref AgentId
          AGENT_ALIAS_NAME: !Ref AgentAliasName
      Events:
        ChatStreamEventMessage:
          Type: Api
          Properties:
            RestApiId: !Ref ChatbotRestApi
            Path: /converse-stream
            Method: POST
            InvokeMode: RESPONSE_STREAM  # Enable streaming        
`

If I add above property (InvokeMode: RESPONSE_STREAM ) and run aws sam command then getting exception:
Number of errors found: 1. Resource with id [ChatStreamEventMessage] is invalid. property InvokeMode not defined for resource of type Api

SAM CLI Version: SAM CLI, version 1.144.0
Python Version:3.13

Activity

  1. added
    stage/needs-triageAutomatically applied to new issues and PRs, indicating they haven't been looked at.
    on Jan 29, 2026
  2. added and removed
    stage/needs-triageAutomatically applied to new issues and PRs, indicating they haven't been looked at.
    on Jan 30, 2026
  3. bnusunny commented on Jan 30, 2026

    @bnusunny
    Contributor

    @ajaypokale Thanks for raising this feature request. In addition to what you asked, do you like to see this feature to be supported in sam local start-api?

  4. ajaypokale commented on Feb 11, 2026

    @ajaypokale
    Author

    Hello,
    Is there any tentative timeline or target release in which this feature will be available?
    This currently blocking our development for streaming chat endpoints used by customers.

  5. DigitalVisionMax commented on Feb 13, 2026

    @DigitalVisionMax

    Hi Team,
    We are also facing similar situation. This feature would help us in resolving our production issue.

    Please prioritize this feature.

  6. seshubaws commented on Feb 13, 2026

    @seshubaws
    Contributor

    Hello, thank you for the request! We will prioritize getting support for response streaming in SAM API events in the next week or two. Adding support for it in sam cli (i.e in sam local start-api) might take a bit longer, we will discuss internally how to prioritize that.

  7. ajaypokale commented on Feb 23, 2026

    @ajaypokale
    Author

    Checking in to see if there’s any update..

  8. ajaypokale commented on Feb 26, 2026

    @ajaypokale
    Author

    Following up !!!

  9. ajaypokale commented on Mar 2, 2026

    @ajaypokale
    Author

    Hi Team,
    Waiting for an update on this case.

  10. reedham-aws commented on Mar 2, 2026

    @reedham-aws
    Contributor

    Seems like the PR (aws/serverless-application-model#3881) is ready to merge, but the approval workflow started failing due to a dependency failure. After that's resolved, we should be able to merge it to SAM.

    Edit: The fix has now been merged, but not released yet.

  11. ajaypokale commented on Mar 3, 2026

    @ajaypokale
    Author

    Hello,
    In which sam releases this feature will be available?
    Thank you!

  12. reedham-aws commented on Mar 4, 2026

    @reedham-aws
    Contributor

    Either 1.108.0 or 1.109.0, not too sure of the status of the release.

    Also, I want to confirm that this is a feature request for the Serverless Application Model itself, not necessarily the CLI? Or are you also looking for CLI support? If it's the former I can transfer this issue to that repository.

  13. 14 remaining items

  14. github-actions commented on Mar 26, 2026

    @github-actions
    Contributor

    Patch is released in v1.157.1. Closing

  15. ajaypokale commented on Mar 31, 2026

    @ajaypokale
    Author

    Hello,
    I was checking whether this feature is available in today’s release, but I do not see the feature ID 8606 included.

    [Stable] Nightly Release v1.157.1.dev202603310901 - 2026-03-31

  16. ajaypokale commented on Apr 7, 2026

    @ajaypokale
    Author

    Hello @bnusunny , @seshubaws
    This feature is not available in today’s release too :(
    feature ID 8606

    [Stable] Nightly Release v1.157.1.dev202604070901 - 2026-04-07

  17. reedham-aws commented on Apr 10, 2026

    @reedham-aws
    Contributor

    I believe this should exist in the newest SAM CLI release (1.158.0). The SAM transform PR was released in 1.109.0, and that was included in the latest release of SAM CLI (linked are the release notes, where you can see that the updated version of SAM is 1.109.0).

    I'm going to close this as completed, feel free to reopen if you can't confirm that it's working.

  18. github-actions commented on Apr 10, 2026

    @github-actions
    Contributor

    ⚠️COMMENT VISIBILITY WARNING⚠️

    Comments on closed issues are hard for our team to see.
    If you need more assistance, please either tag a team member or open a new issue that references this one.
    If you wish to keep having a conversation with other community members under this issue feel free to do so.

  19. slimbu23 commented on Apr 15, 2026

    @slimbu23

    I'm on SAM v1.158.0 and I still get the property InvokeMode not defined for resource of type Api error when trying to deploy.

  20. slimbu23 commented on Apr 15, 2026

    @slimbu23

    @reedham-aws forgot to tag you.

  21. seshubaws commented on Apr 15, 2026

    @seshubaws
    Contributor

    Hi @slimbu23 this property is available via the ResponseTransferMode property in the API event, not through InvokeMode, so should be

    Events:
            ChatStreamEventMessage:
              Type: Api
              Properties:
                RestApiId: !Ref ChatbotRestApi
                Path: /converse-stream
                Method: POST
                ResponseTransferMode: RESPONSE_STREAM
    

    Sorry for the confusion, let us know if that works for you.

  22. github-actions commented on Apr 15, 2026

    @github-actions
    Contributor

    ⚠️COMMENT VISIBILITY WARNING⚠️

    Comments on closed issues are hard for our team to see.
    If you need more assistance, please either tag a team member or open a new issue that references this one.
    If you wish to keep having a conversation with other community members under this issue feel free to do so.

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

      Issue actions