Closed cdaringe closed 8 months ago
Also seeing this. Let me know if I can provide more info! Everything I would say appears to be captured in the parent comment.
Possibly related: some of my (fully unrelated) unit tests are failing with the following message:
/Users/beggers/chroma/hosted-chroma/chroma-dashboard/backend/node_modules/@opentelemetry/otlp-grpc-exporter-base/build/src/OTLPGRPCExporterNodeBase.js:59
onInit(this, config);
^
TypeError: onInit is not a function
at Immediate.<anonymous> (/Users/beggers/chroma/hosted-chroma/chroma-dashboard/backend/node_modules/@opentelemetry/otlp-grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts:87:7)
at processImmediate (node:internal/timers:478:21)
at process.callbackTrampoline (node:internal/async_hooks:130:17)
Node.js v21.0.0
I stand corrected, the above message was likely caused by a change in how my team ran tests. Disregard.
TypeError: onInit is not a function
ya, get that all of the time. same general issue as discussed in the root report
is there any fix? What I found was to mock opentelemetry in all the test cases. But that is not the feasible solution.
is there any fix? What I found was to mock opentelemetry in all the test cases. But that is not the feasible solution.
@charandazn #4432 should include a fix for this. It loads @grpc/grpc-js
on the first export instead of on the next tick.
What happened?
Steps to Reproduce
jest
test that sets up instrumentation usingopentelemetry/otlp-grpc-exporter-base
e.g.
Expected Result
No error.
Actual Result
Error.
Additional Details
onInit
is modeled as a sync function--however, it is certainly async. it's worth considering moving the that dyn require to a dyn import and tracking the control flow versus onInit being purely a side effect.in other words:
onInit: () => void
=>onInit: () => Promise<void>
, and changing the upstream callee patterns as needed.Otherwise, in all of our integration tests, we must mock out a transitive dependency (the OT libs) just to not crash the test runner.
OpenTelemetry Setup Code
package.json
Relevant log output