Open jabrks opened 3 months ago
I had a go at implementing this myself (my Rust isn't quite up to scratch but the code that interacts with the Lambda runtime API is written in TypeScript for the moment) but I don't think we have a way to stream a request body in LLRT currently. I would've ordinarily used the http
API in Node.js but that isn't implemented here with a recommendation to use fetch
instead, which only seems to allow a string
, Array
, ArrayBuffer
or Uint8Array
.
I'd be happy to take another look if there's a preferred way forward here?
Hi @jabrks. We want to support response streams but first we have to implement native streaming for performance reasons https://github.com/awslabs/llrt/issues/178
Hey @richarddavison, have you considered web-streams-polyfill
? It's used in Lagon.
References:
Thanks for the suggestion but we already have a streams polyfill but that won't perform as well as we desire due to lack of a JIT. Basically every byte that flows through a stream implemented will cause multiple function calls, branches, allocations etc.
Thanks @richarddavison, I'll sit tight for now in that case!
It would be great if LLRT supported Lambda response streaming as per https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html#runtimes-custom-response-streaming.