Skip to content

[core] Runtime does not support AWS Lambda Streaming specification #520

Open
@sebsto

Description

@sebsto

Expected behavior

The current version of the runtime allows user handlers functions to return data as a stream. But this is a welcome side effect of the design of the swift runtime. The runtime does not follow the Lambda Runtime API specifications.

As a consequence, it is not possible to return user HTTP headers to a Lambda function URL. Also, it is not possible to interrupt the stream with an error that would be reported to the caller.

Specifically, the Lambda Runtime API specification mandates that a custom runtime return specifics HTTP headers and then use HTTP chunks to return the content
See https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html#runtimes-custom-response-streaming

See Rust's implementation here
https://github.com/awslabs/aws-lambda-rust-runtime/blob/62a36b04ddfd67000d407d06d0da60f394ca4b36/lambda-runtime/src/requests.rs#L103

Actual behavior

It is not possible to return a custom HTTP header to a function URL or to interrupt the stream in case an error occur

Steps to reproduce

n/a

If possible, minimal yet complete reproducer code (or URL to code)

n/a

What version of this project (swift-aws-lambda-runtime) are you using?

main

Swift version

6.x

Amazon Linux 2 docker image version

No response

Metadata

Metadata

Assignees

Labels

kind/enhancementImprovements to existing feature.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions