-
Notifications
You must be signed in to change notification settings - Fork 821
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
@opentelemetry/web does not work in web workers #1575
Comments
Having the same issue trying to implement @opentelemetry/web in Next.js. My issue is essentially the same as OP, so commenting here instead of making a new issue. I initialized
Moving the
urlNormalizingA is referred to, solves the problem for me as all other document references runs client-side (I think).
(I'm not sure if |
I've been hitting the same issues referenced in this issue and will start work on a PR fixing them |
Closing as #2719 landed. |
Co-authored-by: Marc Pichler <[email protected]>
What version of OpenTelemetry are you using?
0.11.0
What version of Node are you using?
v12.18.3
Please provide the code you used to setup the OpenTelemetry SDK
CodeSandbox editor url https://codesandbox.io/s/dark-brook-q5dmi?fontsize=14&hidenavigation=1&theme=dark
CodeSandbox preview https://q5dmi.sse.codesandbox.io/
What did you do?
Just load the page
What did you expect to see?
WebWorker would run successfully with opentelemetry instrumentation
What did you see instead?
Errors when running opentelemetry libs
Additional context
Some of the modules in opentelemetry use modules unavailable in web workers. So far I found these places
opentelemetry-js/packages/opentelemetry-core/src/platform/browser/environment.ts
Line 28 in 60d4dab
this code uses
window
unavailable in web workers, it's simple to fix by replacingwindow
withself
opentelemetry-js/packages/opentelemetry-web/src/utils.ts
Line 32 in 60d4dab
document
is not available in web workers, it's probably possible to use different logic for normalizing URLs eg,new URL
or something elseThe text was updated successfully, but these errors were encountered: