Open lucaswehmuth opened 5 months ago
Working on it
We can use the layerless approach which installs only the New Relic Extension that can transmit telemetry to New Relic. In the layerless approach, we don't need to set custom New Relic handler.
For lambda managed runtimes, need to investigate how to use the Agent+Extension layers as the AWS_LAMBDA_EXEC_WRAPPER
is set to /opt/bootstrap
while language agents also wrap the lambda handler.
In general I find there's a lack of detail in the docs about what things actually do, so when the "happy path" instructions don't work I don't know where to go next...
the layerless docs show this:
import newrelic.agent
from newrelic_lambda.lambda_handler import lambda_handler
newrelic.agent.initialize()
@lambda_handler()
def handler(event, context):
...
it's unclear what the lambda_handler
does and I am unsure how to integrate it in the Lambda Web Adapter case where I have a Django app
I am guessing I should ignore all the newrelic_lambda
stuff and just treat it as a Django app that happens to run on Lambda
similarly I would love to know what NEW_RELIC_SERVERLESS_MODE_ENABLED
does, to know whether I should really enable it or not in this set up
Description
The lambda runtime is unable to locate the _newrelic_lambdawrapper.handler in a lambda that uses the aws-lambda-web-adapter layer (https://github.com/awslabs/aws-lambda-web-adapter) which apparently is another wrapper.
So the issue is trying to set a wrapper inside another wrapper.
Steps to Reproduce
Define a lambda resource using the Serverless Application Model (SAM) like the one below:
or use the sample code provided by AWS itself and then apply the following environment variables:
Expected Behaviour
The value inside the environment variable NEW_RELIC_LAMBDA_HANDLER should be able to be located by the New Relic wrapper
Relevant Logs / Console output
Lambda log error:
/opt/bootstrap: line 3: /var/task/newrelic_lambda_wrapper.handler: No such file or directory
Your Environment
Additional context
Is there any suggested workaround for this lambda scenario? I could not find anything in the docs and neither in any past issues from github