-
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
ReferenceError: Cannot access 'FALLBACK_OTEL_TRACES_SAMPLER' before initialization #2170
Comments
From the code I'm looking at this should definitely not be happening. I wonder if either tsc or webpack is doing some mangling? What tests were causing this? I haven't seen this failure in our CI yet. |
Oh these our my project's tests :) |
I think this might be a bug with your program, not with our library. Can you provide a repro? edit: we should do our best not to crash even with incorrect usage so this is definitely something we want to look into even if it isn't a "bug" |
I was thinking this call is problematic:
As it calls But yeah, I agree it should not crash and probably I am doing something silly like using OTEL env variables :) |
JS function hoisting hoists the function |
Co-authored-by: Valentin Marchaud <[email protected]>
Please answer these questions before submitting a bug report.
What version of OpenTelemetry are you using?
0.19
What version of Node are you using?
14.5.0
Please provide the code you used to setup the OpenTelemetry SDK
N/A
What did you do?
I am trying to run some unit tests in CI and Jest was throwing this error:
If possible, provide a recipe for reproducing the error.
What did you expect to see?
I would expect this error is not happening :)
What did you see instead?
An runtime error is thrown
Additional context
Mostly a ticket to remind myself to look into this issue. Probably need to move the declaring of
FALLBACK_OTEL_TRACES_SAMPLER
above the functionbuildSamplerFromEnv
The text was updated successfully, but these errors were encountered: