question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Must be valid TraceId instance

See original GitHub issue

After upgrading to version 0.18.5 of zipkin-instrumentation-restify and zipkin, I am getting the following error when the request to my server comes in with a traceId: “Error: Must be valid TraceId instance”.

I’ve narrowed the problem down to the following snippet of code in zipkin/tracer/index.js inside the join function

if (!(traceId instanceof TraceId)) {
    throw new Error('Must be valid TraceId instance');
}

This if is always resulting to false, after inspecting the traceid passed to this function, I found the following.

traceId parameter:

TraceId {
  _traceId: 'b7daf2ae1b9e2555',
  _parentId:
   { type: [Getter],
     present: [Getter],
     map: [Function: map],
     ifPresent: [Function: ifPresent],
     flatMap: [Function: flatMap],
     getOrElse: [Function: getOrElse],
     equals: [Function: equals],
     toString: [Function: toString] },
  _spanId: 'b7daf2ae1b9e2555',
  _sampled:
   { type: [Getter],
     present: [Getter],
     map: [Function: map],
     ifPresent: [Function: ifPresent],
     flatMap: [Function: flatMap],
     getOrElse: [Function: getOrElse],
     equals: [Function: equals],
     toString: [Function: toString] },
  _debug: false,
  _shared: false }

traceId instanceof TraceId_1: false traceId.constructor.name: TraceId TraceId_1.constructor.name: Function TraceId.constructor.name: Function

Please note: The usage of TraceId_1 is because that is the output produced after transpilation, and hence is what is being checked in the code when it is actually running.

if (!(traceId instanceof TraceId_1)) {
    throw new Error('Must be valid TraceId instance');
}

This issue only happens if the request is made with the traceid and spanid headers populated.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
codefromthecryptcommented, Jul 24, 2019

https://github.com/openzipkin/zipkin-js/pull/328 introduced this, specifically f665dc3e3efe99760486ae404291a344c2406a92

looking into it and will put a patch up ASAP

1reaction
russell-mattcommented, Jul 24, 2019

Updated to 0.18.6, tested and everything looks fine. Thanks @adriancole for the fast resolution!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tracing In Microservices With Spring Cloud Sleuth
Spring Cloud Sleuth adds two types of IDs to your logging, one called a trace ID and the other called a span ID....
Read more >
Sending trace data to AWS X-Ray
To send data to X-Ray, you need to generate a unique trace ID for each request. Trace IDs must meet the following requirements....
Read more >
Sleuth Header X-B3-TraceId value get Regenerated even if ...
I would like my service consumers pass the TraceId as Header Param with name X-B3-TraceId and valid 128 bits Hex String that shall...
Read more >
Trace Errors Through Your Stack Using Unique Identifiers in ...
Now, errors caused in this transaction or session can be traced/correlated using the unique identifier. While the tracing example used here ...
Read more >
Trace Context - W3C
If the trace-id value is invalid (for example if it contains ... that the opposite is not true: failure to parse tracestate MUST...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found