Allow `invoke_with_response_stream` client calls · Issue #898 · cargo-lambda/cargo-lambda · GitHub
Skip to content

Allow invoke_with_response_stream client calls #898

Closed

Description

@zak-cloudnc

I think this is not implemented yet, but I want to be able to invoke a lambda run with cargo lambda watch with the invoke_with_response_stream style of control plane call to the lambda.

test example (fails)

    #[tokio::test]
    async fn test_local_with_control_plane() {
        let config = aws_config::load_defaults(BehaviorVersion::latest()).await;

        let creds = Credentials::from_keys("dummy", "dummy", None);

        let mut config_builder = aws_sdk_lambda::config::Builder::from(&config)
            .endpoint_url("http://0.0.0.0:9000")
            .region(Region::new("us-east-1"))
            .credentials_provider(creds);

        let lambda_client = aws_sdk_lambda::Client::from_conf(config_builder.build());

        let mut res = lambda_client
            .invoke_with_response_stream()
            .function_name("_")
            .payload(Blob::new("hello world"))
            .send()
            .await.unwrap();

        loop {
            match res.event_stream.recv().await {
                Ok(None) => break,
                Ok(Some(event)) => match event {
                    InvokeWithResponseStreamResponseEvent::InvokeComplete(_) => {
                        println!("invoke complete");
                        break;
                    }
                    InvokeWithResponseStreamResponseEvent::PayloadChunk(payload) => {
                        dbg!(&payload);
                    }
                    _ => todo!(),
                },
                err => {
                    dbg!(err);
                }
            }
        }
    }

My understanding is that the watch crate needs to be extended to implement the route "/2015-03-31/functions/:function_name/response-streaming-invocations" and wrap the streamed chunks in the AWS event stream message framing.

I'd be willing to give this a crack if time allows, but want to sense check that this is a desired thing to have in this repo first (and that I'm not just missing something obvious).

Activity

  1. calavera commented on Dec 11, 2025

    @calavera
    Collaborator

    I'd be willing to give this a crack if time allows, but want to sense check that this is a desired thing to have in this repo first (and that I'm not just missing something obvious).

    I'll happily review and release the change if you implement it. Thanks for opening this issue.

  2. github-actions commented on Feb 14, 2026

    @github-actions
    Contributor

    This issue has been automatically locked. Create a new discussion if you'd like to continue the conversation. https://github.com/cargo-lambda/cargo-lambda/discussions/new?category=general

  3. locked as resolved and limited conversation to collaborators on Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions