You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to run node -r ./tracing.js index.js.
The sdk.start().then(...) is failing - sdk.ts is returning void.
I am using plain JavaScript (not typescript).
Expected Result
sdk.start() should always return same object type: either a promise, a concrete object or undefined. If the returned object is an undefined then .then should not be called on it.
Actual Result
When using webpack - it seems to work for me most time. When using javascript - the returned argument is not a promise and has no .then
Additional Details
Test procedure
mkdir /tmp/dir && cd /tmp/dir
docker run --rm -v /tmp/dir:/home/node/dir -it node:18-alpine sh
cd /home/node/dir
npm init -y
npm i @opentelemetry/sdk-node @opentelemetry/exporter-trace-otlp-http @opentelemetry/instrumentation-fs
node -r ./tracing.js index.js
OpenTelemetry Setup Code
//tracing.js'use strict'constopentelemetry=require('@opentelemetry/sdk-node');const{ OTLPTraceExporter }=require('@opentelemetry/exporter-trace-otlp-http');const{ FsInstrumentation }=require('@opentelemetry/instrumentation-fs');consttraceExporter=newOTLPTraceExporter({url: 'http://otel-collector:4318/v1/traces'});constsdk=newopentelemetry.NodeSDK({
traceExporter,instrumentations: [newFsInstrumentation()],autoDetectResources: true,resourceDetectors: [// By default process information is also addedopentelemetry.resources.envDetector,],});sdk.start().then(()=>console.log("Tracing initialized")).catch((error)=>console.log("Error during initialization"));
/home/node/dir/tracing.js:16
.then(()=>console.log("Tracing initialized"))
^
TypeError: Cannot read properties of undefined (reading 'then')
at Object.<anonymous> (/home/node/dir/tracing.js:16:3)
at Module._compile (node:internal/modules/cjs/loader:1226:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1280:10)
at Module.load (node:internal/modules/cjs/loader:1089:32)
at Module._load (node:internal/modules/cjs/loader:930:12)
at Module.require (node:internal/modules/cjs/loader:1113:19)
at Module._preloadModules (node:internal/modules/cjs/loader:1403:12)
at loadPreloadModules (node:internal/process/pre_execution:621:5)
at setupUserModules (node:internal/process/pre_execution:125:3)
at prepareExecution (node:internal/process/pre_execution:116:5)
The text was updated successfully, but these errors were encountered:
What happened?
Steps to Reproduce
I tried to run
node -r ./tracing.js index.js
.The
sdk.start().then(...)
is failing - sdk.ts is returning void.I am using plain JavaScript (not typescript).
Expected Result
sdk.start()
should always return same object type: either a promise, a concrete object or undefined. If the returned object is an undefined then.then
should not be called on it.Actual Result
When using webpack - it seems to work for me most time. When using javascript - the returned argument is not a promise and has no
.then
Additional Details
Test procedure
OpenTelemetry Setup Code
package.json
Relevant log output
The text was updated successfully, but these errors were encountered: