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.

isOptional and Related checks are wrong and breaks compatibility between versions

See original GitHub issue

Namaste Team

The isOptional check seems to breaking our version compatibility. Our projects use v 0.19 and 0.22 and we have been trying to figure why is our tracing broken using hapi. We seem to have narrowed it down to the bad isOptional check here: https://github.com/openzipkin/zipkin-js/blob/master/packages/zipkin/src/option.js#L65

Log from our service looks like so:

(node:19) UnhandledPromiseRejectionWarning: Error: Error: data (Some(true)) is not an Option!
    at verifyIsOptional (/app/node_modules/service-container/node_modules/zipkin/lib/index.js:223:11)
    at new TraceId (/app/node_modules/service-container/node_modules/zipkin/lib/index.js:773:5)
    at Tracer.createChildId (/app/node_modules/service-container/node_modules/zipkin/lib/index.js:1130:21)
    at HttpClientInstrumentation.recordRequest (/app/node_modules/service-container/node_modules/zipkin/lib/index.js:1929:37)
    at /app/node_modules/service-container/lib/requestRouter/wrapWreckRequest.js:32:48
    at ExplicitContext.scoped (/app/node_modules/service-container/node_modules/zipkin/lib/index.js:1347:16)
    at Tracer.scoped (/app/node_modules/service-container/node_modules/zipkin/lib/index.js:1090:28)
    at /app/node_modules/service-container/lib/requestRouter/wrapWreckRequest.js:31:75
    at new Promise (<anonymous>)

Where service-container is a dependency that bootstraps our service. The app level version is using zipkin@0.22 and the dependecy is using zipkin@0.19. This breaks how we generate trace instance and can be seen in this Proof of Concept PR: https://github.com/openzipkin/zipkin-js/pull/517/files

This, essentially means we cannot even upgrade to fix the issue, because the instanceof check does not seem to be the right way to check for instances. In the POC, even though the class signature is same, isOptional fails.

Please Advise!

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
eirslettcommented, Oct 8, 2020

I don’t think it’s written anywhere. I remember vaguely that this was the solution to a similar problem I encountered some years ago. Using peerDependency will ensure that all your modules are using the same zipkin dependency. What you should do is change the package.json of your service-container source code - and make zipkin a peerDependency. Your main application should have zipkin as a “normal” dependency. Look inside the node_modules folder after running npm install, just to verify that’s the case. (Also, have a look at package-lock.json)

(I’m sorry about the Optional/Some/None thing, it was a terrible design mistake anyway. The code was ported from Scala/Twitter, too literally. Should have used nullable types in JS instead.)

0reactions
jcchavezscommented, Oct 9, 2020

Please let us know if that fixes the issue for you, hapi is breaking on async await. Check this issue about it: https://github.com/openzipkin/zipkin-js/issues/483#issuecomment-583820036

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] npm ci can't resolve dependencies without --force, or ...
Issue here is that in .nvmrc and in our GitHub actions we had lts/gallium specified as our version of node, but then builds...
Read more >
Compatibility between the 32-bit and 64-bit versions of Office
Find out how the 32-bit version of Office is compatible with the 64-bit version of Office.
Read more >
java - Do class changes like field addition or removal maintain ...
Is compatibility broken between these two version? If I deserialize an "oldFoo" when I have the "newFoo" compiled, does eggs equals null or...
Read more >
How to make your REST APIs backward-compatible - InfoWorld
Take advantage of these best practices to ensure that changes to your API don't break compatibility with current clients.
Read more >
A GitHub workflow to check the compatibility of your PHP ...
We will build it up incrementally, using an example project that we will update as we expand the range of supported dependency versions....
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