Skip to content

Commit 70826e1

Browse files
committed
fix: removed support for experimental loader flag
1 parent f9f068c commit 70826e1

File tree

5 files changed

+171
-0
lines changed

5 files changed

+171
-0
lines changed

packages/aws-fargate/src/index.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,35 @@
55
'use strict';
66

77
const path = require('path');
8+
const { esm: esmUtil } = require('@instana/core/src/util');
9+
10+
// Check for unsupported ESM loader configurations and exit early
11+
if (esmUtil.hasExperimentalLoaderFlag()) {
12+
// eslint-disable-next-line no-console
13+
console.error(
14+
'Node.js introduced breaking changes in versions 18.19.0 and above, leading to the discontinuation of support ' +
15+
`for the --experimental-loader flag by Instana. The current Node.js version is ${process.version} and ` +
16+
'this process will not be monitored by Instana. ' +
17+
"To ensure tracing by Instana, please use the '--import' flag instead. For more information, " +
18+
'refer to the Instana documentation: ' +
19+
'https://www.ibm.com/docs/en/instana-observability/current?topic=nodejs-collector-installation.'
20+
);
21+
return;
22+
}
23+
24+
// This loader worked with '--experimental-loader' in Node.js versions below 18.19.
25+
// TODO: Remove 'esm-loader.mjs' file and this log in the next major release (v6).
26+
if (esmUtil.hasEsmLoaderFile()) {
27+
// eslint-disable-next-line no-console
28+
console.error(
29+
"Detected use of 'esm-loader.mjs'. This file is no longer supported and will be removed in next major release. " +
30+
'This process will not be monitored by Instana. ' +
31+
"To ensure tracing by Instana, please use the 'esm-register.mjs' file instead. For more information, " +
32+
'refer to the Instana documentation: ' +
33+
'https://www.ibm.com/docs/en/instana-observability/current?topic=nodejs-collector-installation.'
34+
);
35+
return;
36+
}
837

938
try {
1039
// eslint-disable-next-line no-console

packages/azure-container-services/src/index.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
'use strict';
66

77
const { isNodeJsTooOld, minimumNodeJsVersion } = require('@instana/core/src/util/nodeJsVersionCheck');
8+
const { esm: esmUtil } = require('@instana/core/src/util');
89

910
// As of now, Azure App Service supports Node.js versions 16-lts,18-lts and 20-lts. However, for existing services,
1011
// older Node.js versions might still be supported. You can find more information about configuring Node.js on Azure
@@ -19,6 +20,33 @@ if (isNodeJsTooOld()) {
1920
return;
2021
}
2122

23+
if (esmUtil.hasExperimentalLoaderFlag()) {
24+
// eslint-disable-next-line no-console
25+
console.error(
26+
'Node.js introduced breaking changes in versions 18.19.0 and above, leading to the discontinuation of support ' +
27+
`for the --experimental-loader flag by Instana. The current Node.js version is ${process.version} and ` +
28+
'this process will not be monitored by Instana. ' +
29+
"To ensure tracing by Instana, please use the '--import' flag instead. For more information, " +
30+
'refer to the Instana documentation: ' +
31+
'https://www.ibm.com/docs/en/instana-observability/current?topic=nodejs-collector-installation.'
32+
);
33+
return;
34+
}
35+
36+
// This loader worked with '--experimental-loader' in Node.js versions below 18.19.
37+
// TODO: Remove 'esm-loader.mjs' file and this log in the next major release (v6).
38+
if (esmUtil.hasEsmLoaderFile()) {
39+
// eslint-disable-next-line no-console
40+
console.error(
41+
"Detected use of 'esm-loader.mjs'. This file is no longer supported and will be removed in next major release. " +
42+
'This process will not be monitored by Instana. ' +
43+
"To ensure tracing by Instana, please use the 'esm-register.mjs' file instead. For more information, " +
44+
'refer to the Instana documentation: ' +
45+
'https://www.ibm.com/docs/en/instana-observability/current?topic=nodejs-collector-installation.'
46+
);
47+
return;
48+
}
49+
2250
const { util: coreUtil } = require('@instana/core');
2351
const { environment: environmentUtil, consoleLogger: log } = require('@instana/serverless');
2452

packages/core/src/index.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,34 @@ function registerAdditionalInstrumentations(additionalInstrumentationModules) {
6262
* @param {import('./config').InstanaConfig} preliminaryConfig
6363
*/
6464
function preInit(preliminaryConfig) {
65+
// Check for unsupported ESM loader configurations and exit early
66+
if (util.esm.hasExperimentalLoaderFlag()) {
67+
// eslint-disable-next-line no-console
68+
console.error(
69+
'Node.js introduced breaking changes in versions 18.19.0 and above, leading to the discontinuation of support ' +
70+
`for the --experimental-loader flag by Instana. The current Node.js version is ${process.version} and ` +
71+
'this process will not be monitored by Instana. ' +
72+
"To ensure tracing by Instana, please use the '--import' flag instead. For more information, " +
73+
'refer to the Instana documentation: ' +
74+
'https://www.ibm.com/docs/en/instana-observability/current?topic=nodejs-collector-installation.'
75+
);
76+
return; // Exit early - no-op
77+
}
78+
79+
// This loader worked with '--experimental-loader' in Node.js versions below 18.19.
80+
// TODO: Remove 'esm-loader.mjs' file and this log in the next major release (v6).
81+
if (util.esm.hasEsmLoaderFile()) {
82+
// eslint-disable-next-line no-console
83+
console.error(
84+
"Detected use of 'esm-loader.mjs'. This file is no longer supported and will be removed in next major release. " +
85+
'This process will not be monitored by Instana. ' +
86+
"To ensure tracing by Instana, please use the 'esm-register.mjs' file instead. For more information, " +
87+
'refer to the Instana documentation: ' +
88+
'https://www.ibm.com/docs/en/instana-observability/current?topic=nodejs-collector-installation.'
89+
);
90+
return; // Exit early - no-op
91+
}
92+
6593
util.init(preliminaryConfig);
6694
util.hasThePackageBeenInitializedTooLate.activate();
6795
tracing.preInit(preliminaryConfig);
@@ -77,6 +105,34 @@ function preInit(preliminaryConfig) {
77105
* @param {import('../../collector/src/pidStore')} processIdentityProvider
78106
*/
79107
function init(config, downstreamConnection, processIdentityProvider) {
108+
// Check for unsupported ESM loader configurations and exit early
109+
if (util.esm.hasExperimentalLoaderFlag()) {
110+
// eslint-disable-next-line no-console
111+
console.error(
112+
'Node.js introduced breaking changes in versions 18.19.0 and above, leading to the discontinuation of support ' +
113+
`for the --experimental-loader flag by Instana. The current Node.js version is ${process.version} and ` +
114+
'this process will not be monitored by Instana. ' +
115+
"To ensure tracing by Instana, please use the '--import' flag instead. For more information, " +
116+
'refer to the Instana documentation: ' +
117+
'https://www.ibm.com/docs/en/instana-observability/current?topic=nodejs-collector-installation.'
118+
);
119+
return; // Exit early - no-op
120+
}
121+
122+
// This loader worked with '--experimental-loader' in Node.js versions below 18.19.
123+
// TODO: Remove 'esm-loader.mjs' file and this log in the next major release (v6).
124+
if (util.esm.hasEsmLoaderFile()) {
125+
// eslint-disable-next-line no-console
126+
console.error(
127+
"Detected use of 'esm-loader.mjs'. This file is no longer supported and will be removed in next major release. " +
128+
'This process will not be monitored by Instana. ' +
129+
"To ensure tracing by Instana, please use the 'esm-register.mjs' file instead. For more information, " +
130+
'refer to the Instana documentation: ' +
131+
'https://www.ibm.com/docs/en/instana-observability/current?topic=nodejs-collector-installation.'
132+
);
133+
return; // Exit early - no-op
134+
}
135+
80136
util.init(config);
81137
util.hasThePackageBeenInitializedTooLate.activate();
82138
secrets.init(config);

packages/google-cloud-run/src/index.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,35 @@
55
'use strict';
66

77
const path = require('path');
8+
const { esm: esmUtil } = require('@instana/core/src/util');
9+
10+
// Check for unsupported ESM loader configurations and exit early
11+
if (esmUtil.hasExperimentalLoaderFlag()) {
12+
// eslint-disable-next-line no-console
13+
console.error(
14+
'Node.js introduced breaking changes in versions 18.19.0 and above, leading to the discontinuation of support ' +
15+
`for the --experimental-loader flag by Instana. The current Node.js version is ${process.version} and ` +
16+
'this process will not be monitored by Instana. ' +
17+
"To ensure tracing by Instana, please use the '--import' flag instead. For more information, " +
18+
'refer to the Instana documentation: ' +
19+
'https://www.ibm.com/docs/en/instana-observability/current?topic=nodejs-collector-installation.'
20+
);
21+
return;
22+
}
23+
24+
// This loader worked with '--experimental-loader' in Node.js versions below 18.19.
25+
// TODO: Remove 'esm-loader.mjs' file and this log in the next major release (v6).
26+
if (esmUtil.hasEsmLoaderFile()) {
27+
// eslint-disable-next-line no-console
28+
console.error(
29+
"Detected use of 'esm-loader.mjs'. This file is no longer supported and will be removed in next major release. " +
30+
'This process will not be monitored by Instana. ' +
31+
"To ensure tracing by Instana, please use the 'esm-register.mjs' file instead. For more information, " +
32+
'refer to the Instana documentation: ' +
33+
'https://www.ibm.com/docs/en/instana-observability/current?topic=nodejs-collector-installation.'
34+
);
35+
return;
36+
}
837

938
try {
1039
// eslint-disable-next-line no-console

packages/serverless-collector/src/index.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,35 @@ if (isNodeJsTooOld()) {
1616
}
1717

1818
const { util: coreUtil } = require('@instana/core');
19+
20+
// Check for unsupported ESM loader configurations and exit early
21+
if (coreUtil.esm.hasExperimentalLoaderFlag()) {
22+
// eslint-disable-next-line no-console
23+
console.error(
24+
'Node.js introduced breaking changes in versions 18.19.0 and above, leading to the discontinuation of support ' +
25+
`for the --experimental-loader flag by Instana. The current Node.js version is ${process.version} and ` +
26+
'this process will not be monitored by Instana. ' +
27+
"To ensure tracing by Instana, please use the '--import' flag instead. For more information, " +
28+
'refer to the Instana documentation: ' +
29+
'https://www.ibm.com/docs/en/instana-observability/current?topic=nodejs-collector-installation.'
30+
);
31+
return;
32+
}
33+
34+
// This loader worked with '--experimental-loader' in Node.js versions below 18.19.
35+
// TODO: Remove 'esm-loader.mjs' file and this log in the next major release (v6).
36+
if (coreUtil.esm.hasEsmLoaderFile()) {
37+
// eslint-disable-next-line no-console
38+
console.error(
39+
"Detected use of 'esm-loader.mjs'. This file is no longer supported and will be removed in next major release. " +
40+
'This process will not be monitored by Instana. ' +
41+
"To ensure tracing by Instana, please use the 'esm-register.mjs' file instead. For more information, " +
42+
'refer to the Instana documentation: ' +
43+
'https://www.ibm.com/docs/en/instana-observability/current?topic=nodejs-collector-installation.'
44+
);
45+
return;
46+
}
47+
1948
const { environment: environmentUtil, consoleLogger: serverlessLogger } = require('@instana/serverless');
2049

2150
// TODO: we currently call "log.init()" twice. Once here

0 commit comments

Comments
 (0)