-
Notifications
You must be signed in to change notification settings - Fork 154
Feature request: avoid tracing API calls made during init (top-level await
)
#2406
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
Comments
Just landed here as I was wondering why I'm seeing that error. My use case isn't necessary valid. I was just testing out various (premature 😅 ) optimizations where I call one async function (that essentially initializes a Promise that starts making HTTP calls) before the handler function and then later in the handler I actually |
Is there maybe a workaround to disable the logging of that error? This error message clutters our logs 😅. |
The log comes from the X-Ray SDK for Node.js as we can see from the stack trace above. I haven't tested it, but I think setting the |
Thx for the answer, I'll try that. |
I can confirm that with the environment variable |
I will be opening a PR that updates our Tracer utility to automatically set the I've been investigating alternatives and given that the error comes from the feature that instruments http requests made by the underlying I think this is a middle ground that will help remove the clutter while still allowing flexibility to revert to the original behavior. The AWS X-Ray SDK was never thought with top-level await in mind after all. |
This issue is now closed. Please be mindful that future comments are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so. |
This is now released under v2.8.0 version! |
Use case
Currently when using the Parameters and Tracer utility together, and with top-level
await
(like shown below) used in a certain order an error is logged (but not thrown) informing that the X-Ray SDK is unable to find a trace root (expected).This is the log emitted by the AWS X-Ray SDK, which attempts to trace the request made
This is expected in the sense that trace data is available only within the
handler
scope and made available by the AWS Lambda service only when invoking your function.This is not a runtime error (which is also why this is a feature request and not a bug) but nevertheless it's a nuisance and we should try to find a way to handle this case without making the AWS X-Ray SDK log the error.
Note that swapping the order of the Tracer instantiation and the Parameters call, like below, fixes the issue:
Solution/User Experience
The experience for customers should stay as-is and the change should be backwards compatible.
Alternative solutions
No response
Acknowledgment
Future readers
Please react with 👍 and your use case to help us understand customer demand.
The text was updated successfully, but these errors were encountered: