Open paul-uz opened 3 years ago
Hi @paul-uz,
You cannot retrieve any X-Ray subsegments/segments outside the Lambda function handler, which is why you are receiving this error. Moving the getSegment()
to within your handler function should fix your issue. See more here: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-tracing.html
@willarmiros I suspected as much, and whilst I did not get any errors afterwards, I simply don't think it worked :/
EDIT - I took a look at the page you linked, and it only really shows how to iclude the xray sdk. It lack any real information on how to implement tracing. the code example they give is incomplete :/
hi paul-uz,
You can enable debug logs on Lambda via the AWS_XRAY_DEBUG_MODE environment variable to better log your trace functionality to verify if the behavior is correct. https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-configuration.html#xray-sdk-nodejs-configuration-logging
Can you post any findings here?
Thanks, Sandra
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in next 7 days. Thank you for your contributions.
This is my solution,
if (process.env.IS_OFFLINE) { AWSXRay.setContextMissingStrategy("LOG_ERROR"); }
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in next 7 days. Thank you for your contributions.
I am trying to set up some custom subsegments to gather timings of operations.
Code below:
When hitting the API endpoint, I'm getting "Error: Missing AWS Lambda trace data for X-Ray. Expected _X_AMZN_TRACE_ID to be set" in the logs.
I am following the information here https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-subsegments.html#xray-sdk-nodejs-subsegments-lambda