Skip to content

Steaming Lambda Function "setContentType is not a function" #12090

Closed Answered by LewisW
andreaselia asked this question in Q&A
Discussion options

You must be logged in to vote

I have this same error for a non-function URL based lambda but in your case, for function url based lambdas, you need to call:

                const metadata = {
                    statusCode: 200,
                    headers: {
                        "Content-Type": "application/json",
                    }
                };
                
                // Assign to the responseStream parameter to prevent accidental reuse of the non-wrapped stream.
                responseStream = awslambda.HttpResponseStream.from(responseStream, metadata);
                

See: https://docs.aws.amazon.com/lambda/latest/dg/response-streaming-tutorial.html#response-streaming-tutorial-create-functi…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
3 replies
@andreaselia
Comment options

@LewisW
Comment options

@andreaselia
Comment options

Answer selected by andreaselia
Comment options

You must be logged in to vote
2 replies
@IlmariKu
Comment options

@LewisW
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants