Skip to content

InvokeWithResponseStream

Source: src/AWS/Lambda/InvokeWithResponseStream.ts

Runtime binding for lambda:InvokeFunction over the response-streaming API. Invokes the bound Function and returns the streaming response — EventStream yields PayloadChunk events followed by a final InvokeComplete event.

Provide the InvokeWithResponseStreamHttp layer on the Function to satisfy the binding.

const invokeStream = yield* AWS.Lambda.InvokeWithResponseStream(target);
const response = yield* invokeStream({
Payload: new TextEncoder().encode(JSON.stringify({ prompt: "hi" })),
});
const chunks = yield* Stream.runCollect(response.EventStream!);