-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined header errors with LambdaProxyWebRequest and destination lambdas #2291
Comments
@sleighzy Thank you for the thorough bug report and reproduction case. I'm sorry to hear you're having trouble with this change. We'll look into this. |
Thanks for the quick turnaround on the fix. One thing to note is though the fix will prevent the error from occurring the logic in here will still wrap any lambda with version 1.0 in a LambdaProxyWebRequest, even though these may not be API gateway lambdas, e.g. a destination lambda. |
Description
We use the serverless-newrelic-lambda-layers plugin for our lambdas. This includes both http lambdas and destination lambdas. We have experienced an issue whereby the
x-forwarded-port
header is attempted to be retrieved from non-existent headers when our destination lambda is invoked. This is preventing the lambda from running.Expected Behavior
This issue started occurring on May 16th. It appears that the node-newrelic v11.17.0 release introduced a change that is causing this problem, which is being used by the
serverless-newrelic-lambda-layers
.Looking at this release it appears there may be an issue in #2191 around the APIGateway check to see if this is a lambda proxy event. This previously used to check for the presence of headers, but was updated to just check the version number, e.g. returns
true
if the version is 1.0.. If this is true then it attempts to normalise the headers and pull thex-forwarded-port
header from it, which fails as thelowerCaseHeaders
are undefined.For the lambda experiencing this issue it is an AWS destination lambda vs. http so does not have those headers. The lambda proxy check in this change is however incorrectly identifying it as needing the web proxy wrapped around it.
Steps to Reproduce
This can be replicated by using two lambdas.
After successfully executing the normal lambda operation the destination lambda will not be invoked and the logs will contain the information as per the description re: the undefined object when trying to get the headers.
Your Environment
Additional context
As per the server-newrelic-lambda-layers documentation we have added the custom
layerArn
value to pin to an earlier version of the lambda layers (68
as69
introduces the problem) that contains the previous version of the node agent that does not contain this breaking change. This is working as expected.The text was updated successfully, but these errors were encountered: