-
Notifications
You must be signed in to change notification settings - Fork 36
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
fix: resolved esm loader issue for manual instrumentation node v18.19.0 and above #1063
Conversation
4da6bbe
to
4b83d46
Compare
4b83d46
to
c9fa51d
Compare
faa88a9
to
722f0a6
Compare
af5156c
to
1b882ce
Compare
029c460
to
d4c4d23
Compare
32b8402
to
d583209
Compare
d583209
to
f84b8d4
Compare
83e46b5
to
198c762
Compare
packages/collector/test/tracing/sdk/multiple_installations/esm/src/register.mjs
Outdated
Show resolved
Hide resolved
Question: the PR pipeline runs with Node 18.18. How do we know that the tests are green for aws-fargate & 18.19? |
4e2ca32
to
1956bdc
Compare
Tested with v20 in a seprate pipeline, thanks again for pointing this ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 👹
Starting from version 20.6, ESM loaders are off-threaded, loaded in separate thread, whereas previously we were loading our Instana collector in loader, so the change broke existing implementation. To resolve this, we used the
--import
flag, replacing the deprecated--experimental-loader
and allowing the collector to load within the main thread.Note that --import is supported only in Node.js versions 18.19 and later. Thus, we maintain both loading styles for compatibility across different Node.js versions.
To enable experimental ESM support, use the following command:
For Node.js versions greater than or equal to 18.19:
node --import /path/to/instana/node_modules/@instana/collector/esm-register.mjs entry-point
For Node.js versions less than 18.19:
node --experimental-loader /path/to/instana/node_modules/@instana/collector/esm-loader.mjs entry-point
We're actively working on implementing native ESM support, targeted for resolution in INSTA-807.
References:
Move ESM loaders off-thread
nodejs/node#47880
Notes:
--import
flag is still on experimental phase.Tasks
Post Release