Join us

What is AWS Lambda's new Streaming Response?

What is AWS Lambda's new Streaming Response?

Lambda previously had a limit of 6MB on request and response payloads for synchronous invocations, which affected API functions and the amount of data you could send and receive.

A common workaround was to put larger files on S3 and return a presigned URL, but this added latency and complexity.

However, with the new Response Streaming feature, Lambda can now return payloads larger than 6MB. To use this feature, you need to wrap your function code with the new streamifyResponse decorator and upgrade to the node14.x, node16.x, or node18.x runtime.

The requestStream contains the invocation event and the responseStream is a writable Stream object that streams bytes to the client. This feature can simplify returning larger objects, improve time-to-first-byte for multimedia content, and stream progress updates for long-running tasks.

However, there are some caveats, such as a default payload size limit of 20MB and compatibility issues with API Gateway and ALB.


Only registered users can post comments. Please, login or signup.

Start blogging about your favorite technologies, reach more readers and earn rewards!

Join other developers and claim your FAUN account now!

Avatar

The FAUN

@faun
A worldwide community of developers and DevOps enthusiasts!
User Popularity
3k

Influence

280k

Total Hits

1

Posts