newrelic / node-newrelic

New Relic Node.js agent code base. Developers are welcome to create pull requests here, please see our contributing guidelines. For New Relic technical support, please go to http://support.newrelic.com.
Apache License 2.0
967 stars 399 forks source link

Support for Lambdas with response streaming #1653

Open dion-conqa opened 1 year ago

dion-conqa commented 1 year ago

Adding NR monitoring to a lambda with a response stream breaks the response stream.

Description

We are converting a function from Elastic Beanstalk to a lambda with response streaming. The only reason this function has been running on EB is because the response payload can be greater than 6MB.

When adding the New Relic agent, we have found that wrapping the handler function in newrelic.setLambdaHandler causes the responseStream parameter to be undefined when the lambda runs.

For this lambda we aren't using the lambda layer. I haven't tested with the layer, but I would expect the same behaviour.

Expected Behavior

responseStream won't be affected by the handler function being wrapped in the newrelic.setLambdaHandler function.

Steps to Reproduce

Create a lambda with a response stream. Aws have examples here https://github.com/aws-samples/serverless-patterns/tree/main/lambda-streaming-ttfb-write-sam

Add the New Relic agent to the package.json

Wrap the handler in the newrelic.setLambdaHandler function.

Check if responseStream is undefined

Your Environment

AWS Lambda x86

Additional context

workato-integration[bot] commented 1 year ago

https://issues.newrelic.com/browse/NEWRELIC-8859

workato-integration[bot] commented 1 year ago

Jira CommentId: 211906 Commented by svengala:

Our existing Lambda/serverless products are in maintenance mode. We are re evaluating the strategy for support and will realign once confirmed.

workato-integration[bot] commented 1 year ago

This issue won't be actioned.

heypiotr commented 1 year ago

New Relic:

Monitor your Lambda Response Streaming with New Relic https://docs.newrelic.com/whats-new/2023/04/whats-new-04-07-lambda-streaming/

Also New Relic:

Support for Lambdas with response streaming This issue won't be actioned.

😭