Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot set property Tracer of #<Object> which has only a getter #4963

Closed
kukadiyaAni opened this issue Aug 29, 2024 · 5 comments
Closed
Labels
bug Something isn't working needs:reproducer This bug/feature is in need of a minimal reproducer pkg:sdk-trace-base triage

Comments

@kukadiyaAni
Copy link

What happened?

Steps to Reproduce

After release new version @opentelemetry/sdk-trace-base is 1.26.0 start getting this error

Additional Details

TypeError: Cannot set property Tracer of #<Object> which has only a getter at Object.<anonymous> (/node_modules/@opentelemetry/sdk-trace-base/build/src/index.js:18:407) at Module._compile (node:internal/modules/cjs/loader:1241:14) at Module._extensions..js (node:internal/modules/cjs/loader:1295:10) at Module.load (node:internal/modules/cjs/loader:1091:32) at Module._load (node:internal/modules/cjs/loader:938:12) at Module.require (node:internal/modules/cjs/loader:1115:19) at require (node:internal/modules/helpers:130:18) at Object.<anonymous> (/node_modules/@opentelemetry/sdk-trace-base/build/src/BasicTracerProvider.js:22:12) at Module._compile (node:internal/modules/cjs/loader:1241:14) at Module._extensions..js (node:internal/modules/cjs/loader:1295:10) (node:36506) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)

OpenTelemetry Setup Code

No response

package.json

No response

Relevant log output

No response

@kukadiyaAni kukadiyaAni added bug Something isn't working triage labels Aug 29, 2024
@pichlermarc pichlermarc added pkg:sdk-trace-base needs:reproducer This bug/feature is in need of a minimal reproducer labels Aug 29, 2024
@pichlermarc
Copy link
Member

@kukadiyaAni there's not much info to work with here - the only change to the @opentelemetry/sdk-trace-base package was that we modified re-exports in #4880 so there might be something going on here but it's hard to tell without a reproducer.

Qs:

  • Which Node.js version are you running on?
  • How are you setting up your SDK? (OTel Setup code)
    • imports/require statements would be of interest here as it's happening in the loader.

@kukadiyaAni
Copy link
Author

kukadiyaAni commented Aug 29, 2024

@pichlermarc Thank you for the quick response I fixed the issue below changes

diff --git a/node_modules/@opentelemetry/sdk-trace-base/build/src/index.js b/node_modules/@opentelemetry/sdk-trace-base/build/src/index.js
index a11fe78..7847a70 100644
--- a/node_modules/@opentelemetry/sdk-trace-base/build/src/index.js
+++ b/node_modules/@opentelemetry/sdk-trace-base/build/src/index.js
@@ -15,7 +15,10 @@
  * limitations under the License.
  */
 Object.defineProperty(exports, "__esModule", { value: true });
-exports.Span = exports.SamplingDecision = exports.TraceIdRatioBasedSampler = exports.ParentBasedSampler = exports.AlwaysOnSampler = exports.AlwaysOffSampler = exports.NoopSpanProcessor = exports.SimpleSpanProcessor = exports.InMemorySpanExporter = exports.ConsoleSpanExporter = exports.RandomIdGenerator = exports.BatchSpanProcessor = exports.ForceFlushState = exports.BasicTracerProvider = exports.Tracer = void 0;
+if (!Object.getOwnPropertyDescriptor(exports, 'Tracer')) {
+    exports.Tracer = void 0;
+}
+exports.Span = exports.SamplingDecision = exports.TraceIdRatioBasedSampler = exports.ParentBasedSampler = exports.AlwaysOnSampler = exports.AlwaysOffSampler = exports.NoopSpanProcessor = exports.SimpleSpanProcessor = exports.InMemorySpanExporter = exports.ConsoleSpanExporter = exports.RandomIdGenerator = exports.BatchSpanProcessor = exports.ForceFlushState = exports.BasicTracerProvider = exports.Tracer;
 var Tracer_1 = require("./Tracer");
 Object.defineProperty(exports, "Tracer", { enumerable: true, get: function () { return Tracer_1.Tracer; } });
 var BasicTracerProvider_1 = require("./BasicTracerProvider");

@pichlermarc
Copy link
Member

pichlermarc commented Aug 29, 2024

@kukadiyaAni to help, I'm looking for how you import/require OTel Components in your app. To be able to fix it upstream I need to be able to reproduce it. I cannot reproduce the limited info that I have available here.

@dyladan
Copy link
Member

dyladan commented Sep 11, 2024

@kukadiyaAni can you please provide a reproduction? We can't really look into this without being able to easily reproduce it.

@dyladan dyladan closed this as completed Sep 25, 2024
@dyladan
Copy link
Member

dyladan commented Sep 25, 2024

Closing this because there isn't enough info here to reproduce the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs:reproducer This bug/feature is in need of a minimal reproducer pkg:sdk-trace-base triage
Projects
None yet
Development

No branches or pull requests

3 participants