opentracing / opentracing-javascript

OpenTracing API for Javascript (both Node and browser). 🛑 This library is DEPRECATED! https://github.com/opentracing/specification/issues/163
http://opentracing.io
Apache License 2.0
1.09k stars 108 forks source link

After latest release we have blocker issue #172

Closed cristiboariu closed 2 years ago

cristiboariu commented 2 years ago

After your latest release (v0.14.6) we encounter:

Error encountered when starting the app: TypeError: Cannot use 'in' operator to search for 'context' in null
/opt/app/node_modules/opentracing/lib/reference.js:14
    if (contextOrSpan instanceof span_1.default || 'context' in contextOrSpan) {
                                                             ^

TypeError: Cannot use 'in' operator to search for 'context' in null
    at toContext (/opt/app/node_modules/opentracing/lib/reference.js:14:62)
    at new Reference (/opt/app/node_modules/opentracing/lib/reference.js:37:35)
    at Object.requestTrace [as request] (/opt/app/node_modules/dd-trace/packages/datadog-plugin-http/src/client.js:57:11)
    at retriableRequest (/opt/app/node_modules/dd-trace/packages/dd-trace/src/exporters/agent/request.js:13:22)
    at request (/opt/app/node_modules/dd-trace/packages/dd-trace/src/exporters/agent/request.js:53:24)
    at makeRequest (/opt/app/node_modules/dd-trace/packages/dd-trace/src/exporters/agent/writer.js:127:3)
    at Writer._sendPayload (/opt/app/node_modules/dd-trace/packages/dd-trace/src/exporters/agent/writer.js:31:5)
    at Writer.flush (/opt/app/node_modules/dd-trace/packages/dd-trace/src/exporters/agent/writer.js:80:12)
    at Timeout._onTimeout (/opt/app/node_modules/dd-trace/packages/dd-trace/src/exporters/agent/index.js:14:58)
cristiboariu commented 2 years ago

@yurishkuro can you please help? Our PROD build is no longer working :(

Bug seems to be introduced here: https://github.com/opentracing/opentracing-javascript/commit/1380d0ffab6401fed9cdaabdcb88f2edf1b3c7dd#diff-d0d962ccc0784d6699fb4dcfc79d3acd8cff4d081f77e13a164510c48459d35fR14

lmuench commented 2 years ago

we are experiencing the same issue. non-stop uncaught exceptions in some of our services (opentracing is pulled in by those services' dd-trace dependency)

jneal-afs commented 2 years ago

Seeing this as well

jneal-afs commented 2 years ago

@yurishkuro Just want to make sure you are aware. We are currently trying to force a rollback to v0.14.5 in our systems as we currently can't deploy any new code.

AMOpportunitiesDeveloper commented 2 years ago

dd-trace datadogs agent uses this dependency and we can not deploy any code now. this is a major issue.

yurishkuro commented 2 years ago

apologies, everyone, I am reverting the change in a new patch

yurishkuro commented 2 years ago

opentracing@0.14.7 published that is equal to opentracing@0.14.5

yurishkuro commented 2 years ago

btw, I think the original null-ptr issue is here: https://github.com/DataDog/dd-trace-js/blob/21179be27f7f9487e8287056fa08e404f5e6ef14/packages/datadog-plugin-http/src/client.js#L54

This code is calling new Reference(type, parentCtx) constructor with parentCtx=null, which is invalid per constructor signature: https://github.com/opentracing/opentracing-javascript/blob/9a4856ef20597c1a1a2ffc4072dd9a497af22b8d/src/reference.ts#L57

yurishkuro commented 2 years ago

While not ideal, #174 adds support for previous "illegal" usage of the constructor.

dhay commented 2 years ago

I was facing this issue as well and can confirm that the 0.14.7 build fixes the problem. I was about to post this exact issue with the suggestion that the line in question add a null/undefined check...but, without digging further, that may just kick the problem further downstream

yurishkuro commented 2 years ago

@cristiboariu @lmuench @jneal-afs @amopportunities @dhay can you test your code with PR #174 (it's on a public branch) to confirm if it resolves the issue?