Skip to content
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

Injected aws.lambda_request_id is wrong #303

Open
alexandruluca opened this issue Jan 21, 2025 · 2 comments
Open

Injected aws.lambda_request_id is wrong #303

alexandruluca opened this issue Jan 21, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@alexandruluca
Copy link

alexandruluca commented Jan 21, 2025

Description

I am using the newrelic layer on a nodejs lambda function.
The lambda runtime is Node.js 20.x and the layer arn is arn:aws:lambda:eu-west-1:451483290750:layer:NewRelicNodeJS20XARM64:51

(I have also tried using Node.js 22.x and latest layer version and still got the same issue)

When inspecting logs using the newrelic UI and when I tried correlating them using aws.lambda_request_id, I have noticed I get strange
data and something was not adding up.

The aws.lambda_request_id which is automatically injected via the layer, had the wrong aws request id in some cases.
In some cases, it seems it always has the previous request id.

This behaviour can be seen more clear in following screenshot. I have explicitly injected the awsRequestId using pino-lambda to try and compare and to troubleshoot the issue(the request id is ready from context each time the handler is called), and logger
As

Steps to Reproduce

This does not appear to happen at small scale, but only whenever we have concurrent invocations.

Here is a screenshot to illustrate behaviour.

Image

I have managed to work around this by explicitly injecting aws.lambda_request_id as part of the logger context which I get from the lambda context. It seems the newrelic lambda layer does not ovewrite aws.lambda_request_id if explicitly provided.
This works for me now, but it would be great if this can be fixed from the newrelic layer.

Expected Behaviour

aws.lambda_request_id to always have the correct aws request id from context.

Relevant Logs / Console output

Your Environment

  • ex: Browser name and version:
  • ex: Operating System and version:

Additional context

@alexandruluca alexandruluca added the bug Something isn't working label Jan 21, 2025
@workato-integration
Copy link

@chaudharysaket
Copy link
Contributor

Hi @alexandruluca
Thank you for sharing the issue related to Lambda logs when there are concurrent invocations.
We will work on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants