Skip to content

yotamishak/effect-aws-lambda-streaming-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

effect-aws Lambda Function URL streaming example

This is a small SST app demonstrating LambdaHandler.streamFromHttpApi from @effect-aws/lambda with Lambda Function URL response streaming.

Important

Lambda response streaming works with Lambda Function URLs configured with InvokeMode: RESPONSE_STREAM. API Gateway HTTP API integrations do not support Lambda response streaming.

This example requires the unreleased @effect-aws/lambda change that includes LambdaHandler.streamFromHttpApi. The dependency is installed from a local checkout at ../effect-aws/packages/lambda.

Build the local package before installing or deploying this example:

cd ../effect-aws
pnpm install
pnpm --filter @effect-aws/lambda build

Routes

  • GET /ping returns a normal JSON schema response with handle
  • GET /stream returns a progressive text stream with handleRaw and HttpServerResponse.stream

Deploy

pnpm install
pnpm run deploy

The deploy output includes StreamingUrl.

Test

Normal JSON response:

curl <StreamingUrl>/ping

Progressive streaming response:

curl -N <StreamingUrl>/stream

Or run the smoke script:

pnpm run smoke <StreamingUrl>

Expected output shows chunk 1, chunk 2, chunk 3, and done arriving about one second apart.

Cleanup

pnpm run remove

About

SST example for @effect-aws/lambda Function URL response streaming

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors