The state of AWS Lambda Go Streaming support
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by reproducing the documented lambda.Start example returning events.LambdaFunctionURLStreamingResponse with -tags lambda.norpc on the al2023 or provided runtime, using a Function URL configured with InvokeMode: RESPONSE_STREAM. Trace how the response is encoded and verify whether Body is serialized instead of streamed. Done means the documented Go response reaches the Function URL as streamed content, or the limitation and required runtime conditions are clearly documented.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
I had been trying make the AWS Lambda response streaming work with aws-lambda-go runtime and I was not able to succeed. Neither the Lambda Function URLs or direct API call using InvokeWithResponseStream work and instead I was retrieving the entire response serialized to JSON.
I made my Lambda function return the events.LambdaFunctionURLStreamingResponse, but the entire response had been serialized and returned as JSON. The passed io.Reader had not been proceesed and suprisingly enough the response contain JSON serialized representation of the io.Reader implementation i.e.
{"StatusCode":200,"Headers":{"Content-Type":"application/octet-stream"},"Body":{"ReadCloser":{}},"Cookies":null}
I had been runing the GO Lambda function on al2023 runtime, compiled the binary with -tags lambda.norpc option and set up the Function URL.
FunctionUrl:
Type: AWS::Lambda::Url
Properties:
TargetFunctionArn: !Ref Function
AuthType: NONE
InvokeMode: RESPONSE_STREAM
Neither of this had any impact and the behavior persisted. Even the documented in code example is not working correctly:
// Example:
//
// lambda.Start(func() (*events.LambdaFunctionURLStreamingResponse, error) {
// return &events.LambdaFunctionURLStreamingResponse{
// StatusCode: 200,
// Headers: map[string]string{
// "Content-Type": "text/html",
// },
// Body: strings.NewReader("<html><body>Hello World!</body></html>"),
// }, nil
// })
//
// Note: This response type requires compiling with `-tags lambda.norpc`, or choosing the `provided` or `provided.al2` runtime.
Which results in response from Function URL:
{"StatusCode":200,"Headers":{"Content-Type":"text/html"},"Body":{},"Cookies":null}
Is Response Streaming not supported with Go runtime?
Describe the solution you'd like
I would like to use Lambda Response Streaming with my Go runtime.
Describe alternatives you've considered
I am not using AWS Lambda for this use case today.
Additional context
github.com/aws/aws-lambda-go v1.47.0
- Dominant language
- Go
- Stars
- 3.8k
- Forks
- 578
- Avg merge
- 16h 56m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws/aws-lambda-go
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
aws/aws-lambda-go#634 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aws/aws-lambda-go#597 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
aws/aws-lambda-go#556 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
aws/aws-lambda-go#610 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
aws/aws-lambda-go#598 ·
All issues in aws/aws-lambda-go
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
crossplane/crossplane#7859 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bazel-contrib/rules_go#4721 · 2 comments ·
-
needs-triage
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
bug carvel-triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
carvel-dev/kapp-controller#1861 ·
-
area/logging kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100