-
Notifications
You must be signed in to change notification settings - Fork 296
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
tracing not working after moving from commonjs to es2020 #2221
Comments
The one-liner import should really only work in explicitly typescript files or with a bundler, not just a plain As for the first approach - the contents of |
@guidev There is experimental support for ESM that can be enabled with |
@guidev I had the same issue with missing HTTP routes in the APM dashboards at the |
@guidev Did you figure out why this was happening? And even better, did you figure out a way to fix it? I am also having the same issue after moving from commonjs to native ESM in node |
@jamesone How are you initializing dd-trace? Also, did you add our ESM loader to the CLI arguments? |
Adding
|
Hey @guidev I tried adding the loader (I am on Node 16.16.0) and I am now getting another error:
I also tried:
These both produced the same error as above. @guidev which version of node did you successfully use the loader with? |
I've seen the same error randomly a couple of times, but now I'm running it successfully on Make sure to have the latest version of |
It seems like there is an issue with the import-in-the-middle library, it cannot handle import assertions. i.e. |
This issue has been fixed in: https://github.com/DataDog/dd-trace-js/tree/v3.3.1 🕺 |
After switching to ES modules, the instrumentation of external libraries (like express) no longer works. Use a module loader provided by dd-trace to fix this, as described here: DataDog/dd-trace-js#2221 (comment) Also initialize the tracer as early as possible to instrument all code.
After switching to ES modules, the instrumentation of external libraries (like express) no longer works. Use a module loader provided by dd-trace to fix this, as described here: DataDog/dd-trace-js#2221 (comment) Also initialize the tracer as early as possible to instrument all code.
Expected behaviour
Actual behaviour
Steps to reproduce
We changed our typescript configuration from commonjs to es2020.
The resulting javascript now looks like this:
previous commonjs version:
The app.js file now looks like this:
previous commonjs version:
We stopped receiving traces on our dashboard.
I've checked the guide at https://docs.datadoghq.com/tracing/trace_collection/dd_libraries/nodejs/?tab=containers, tried using the one liner
import 'dd-trace/init';
but it fails with the following error:
Environment
The text was updated successfully, but these errors were encountered: