Skip to content

[email protected] breaks npm run test:browser in instrumentation-fetch #5701

@trentm

Description

@trentm

https://github.com/open-telemetry/opentelemetry-js/actions/runs/15142757414/job/42571833122?pr=5700
should npm run test:browser failing for instr-fetch for #5700.

long test output
> @opentelemetry/instrumentation-fetch:"test:browser"


> @opentelemetry/[email protected] test:browser
> karma start --single-run

webpack was not included as a framework in karma configuration, setting this automatically...
karma-webpack does not currently support customized filenames via
webpack output.filename, if this is something you need consider opening an issue.
defaulting bundle.js to [name].js.
Webpack bundling...
assets by status 14.8 KiB [compared for emit]
  assets by path ../../home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-fetch/build/src/ 14.3 KiB
    assets by path ../../home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-fetch/build/src/*.ts 10.3 KiB 6 assets
    assets by path ../../home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-fetch/build/src/*.map 3.53 KiB 6 assets
    assets by path ../../home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-fetch/build/src/enums/ 491 bytes 2 assets
  assets by path ../../home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-fetch/build/test/ 516 bytes
    assets by path ../../home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-fetch/build/test/*.map 360 bytes 3 assets
    assets by path ../../home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-fetch/build/test/*.ts 156 bytes
      asset ../../home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-instrumentation-fetch/build/test/index-webpack.d.ts 54 bytes [compared for emit]
      + 2 assets
assets by status 10.3 MiB [emitted]
  asset commons.js 10.3 MiB [emitted] (name: commons) (id hint: commons)
  asset runtime.js 7.64 KiB [emitted] (name: runtime)
  asset index-webpack.3036668705.js 1.04 KiB [emitted] (name: index-webpack.3036668705)
Entrypoint index-webpack.3036668705 10.3 MiB = runtime.js 7.64 KiB commons.js 10.3 MiB index-webpack.3036668705.js 1.04 KiB

ERROR in ../../../node_modules/@open-draft/logger/lib/index.mjs 236:4-11
Module not found: Error: Can't resolve 'process/browser' in '/home/runner/work/opentelemetry-js/opentelemetry-js/node_modules/@open-draft/logger/lib'
Did you mean 'browser.js'?
BREAKING CHANGE: The request 'process/browser' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ../../../node_modules/@mswjs/interceptors/lib/browser/chunk-QED3Q6Z2.mjs 2:0-44 31:22-28
 @ ../../../node_modules/@mswjs/interceptors/lib/browser/index.mjs 9:0-16:30 19:37-48 65:0-78:2 65:0-78:2 65:0-78:2 65:0-78:2 65:0-78:2 65:0-78:2
 @ ../../../node_modules/msw/lib/core/getResponse.mjs 1:0-54 6:15-30
 @ ../../../node_modules/msw/lib/core/index.mjs 14:0-48 22:0-38:2
 @ ./test/fetch.test.ts 30:12-26
 @ ./test/ sync test$ ./fetch.test
 @ ./test/index-webpack.ts 21:21-56

ERROR in ../../../node_modules/is-node-process/lib/index.mjs 6:13-20
Module not found: Error: Can't resolve 'process/browser' in '/home/runner/work/opentelemetry-js/opentelemetry-js/node_modules/is-node-process/lib'
Did you mean 'browser.js'?
BREAKING CHANGE: The request 'process/browser' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ../../../node_modules/msw/lib/core/delay.mjs 1:0-48 7:6-19
 @ ../../../node_modules/msw/lib/core/index.mjs 17:0-28 17:0-28
 @ ./test/fetch.test.ts 30:12-26
 @ ./test/ sync test$ ./fetch.test
 @ ./test/index-webpack.ts 21:21-56

ERROR in ../../../node_modules/msw/lib/browser/index.mjs 90:13-20
Module not found: Error: Can't resolve 'process/browser' in '/home/runner/work/opentelemetry-js/opentelemetry-js/node_modules/msw/lib/browser'
Did you mean 'browser.js'?
BREAKING CHANGE: The request 'process/browser' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ./test/fetch.test.ts 31:18-40
 @ ./test/ sync test$ ./fetch.test
 @ ./test/index-webpack.ts 21:21-56

ERROR in ../../../node_modules/@open-draft/logger/lib/index.mjs
Cannot read properties of undefined (reading 'module')
 @ ../../../node_modules/@mswjs/interceptors/lib/browser/chunk-QED3Q6Z2.mjs 2:0-44 31:22-28
 @ ../../../node_modules/@mswjs/interceptors/lib/browser/index.mjs 9:0-16:30 19:37-48 65:0-78:2 65:0-78:2 65:0-78:2 65:0-78:2 65:0-78:2 65:0-78:2
 @ ../../../node_modules/msw/lib/core/getResponse.mjs 1:0-54 6:15-30
 @ ../../../node_modules/msw/lib/core/index.mjs 14:0-48 22:0-38:2
 @ ./test/fetch.test.ts 30:12-26
 @ ./test/ sync test$ ./fetch.test
 @ ./test/index-webpack.ts 21:21-56

ERROR in ../../../node_modules/is-node-process/lib/index.mjs
Cannot read properties of undefined (reading 'module')
 @ ../../../node_modules/msw/lib/core/delay.mjs 1:0-48 7:6-19
 @ ../../../node_modules/msw/lib/core/index.mjs 17:0-28 17:0-28
 @ ./test/fetch.test.ts 30:12-26
 @ ./test/ sync test$ ./fetch.test
 @ ./test/index-webpack.ts 21:21-56

ERROR in ../../../node_modules/msw/lib/browser/index.mjs
Cannot read properties of undefined (reading 'module')
 @ ./test/fetch.test.ts 31:18-40
 @ ./test/ sync test$ ./fetch.test
 @ ./test/index-webpack.ts 21:21-56

6 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.99.8 compiled with 6 errors in 13923 ms
20 05 2025 16:40:44.693:INFO [karma-server]: Karma v6.4.4 server started at http://localhost:9878/
20 05 2025 16:40:44.695:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
20 05 2025 16:40:44.704:INFO [launcher]: Starting browser ChromeHeadless
20 05 2025 16:40:45.385:INFO [Chrome Headless 136.0.0.0 (Linux x86_64)]: Connected on socket 0oZAYPoUNkCCSa5hAAAB with id 83357362
Chrome Headless 136.0.0.0 (Linux x86_64) ERROR
  Uncaught TypeError: __webpack_modules__[moduleId].call is not a function
  at /tmp/_karma_webpack_263876/runtime.js:31:42
  
  TypeError: __webpack_modules__[moduleId].call is not a function
      at __webpack_require__ (/tmp/_karma_webpack_263876/runtime.js:31:42)
      at eval (webpack-internal:///../../../node_modules/@mswjs/interceptors/lib/browser/chunk-QED3Q6Z2.mjs:10:76)
      at ../../../node_modules/@mswjs/interceptors/lib/browser/chunk-QED3Q6Z2.mjs (/tmp/_karma_webpack_263876/commons.js:568:1)
      at __webpack_require__ (/tmp/_karma_webpack_263876/runtime.js:31:42)
      at eval (webpack-internal:///../../../node_modules/@mswjs/interceptors/lib/browser/index.mjs:18:77)
      at ../../../node_modules/@mswjs/interceptors/lib/browser/index.mjs (/tmp/_karma_webpack_263876/commons.js:590:1)
      at __webpack_require__ (/tmp/_karma_webpack_263876/runtime.js:31:42)
      at eval (webpack-internal:///../../../node_modules/msw/lib/core/utils/matching/matchRequestUrl.mjs:8:77)
      at ../../../node_modules/msw/lib/core/utils/matching/matchRequestUrl.mjs (/tmp/_karma_webpack_263876/commons.js:3731:1)
      at __webpack_require__ (/tmp/_karma_webpack_263876/runtime.js:31:42)

Chrome Headless 136.0.0.0 (Linux x86_64): Executed 0 of 0 ERROR (0.53 secs / 0 secs)

That is a release PR that, as a side-effect of the scripts for handling releases, updating package-lock.json, including this update:

    "node_modules/msw": {
-      "version": "2.7.6",
-      "resolved": "https://registry.npmjs.org/msw/-/msw-2.7.6.tgz",
-      "integrity": "sha512-P+rwn43ktxN8ghcl8q+hSAUlEi0PbJpDhGmDkw4zeUnRj3hBCVynWD+dTu38yLYKCE9ZF1OYcvpy7CTBRcqkZA==",
+      "version": "2.8.4",
+      "resolved": "https://registry.npmjs.org/msw/-/msw-2.8.4.tgz",
+      "integrity": "sha512-GLU8gx0o7RBG/3x/eTnnLd5S5ZInxXRRRMN8GJwaPZ4jpJTxzQfWGvwr90e8L5dkKJnz+gT4gQYCprLy/c4kVw==",

Something in the [email protected] update broke the tests. From @pichlermarc

I looked at it briefly and that seems to be due to our use of node assert in the browser tests (which needs an assert polyfill, and that polyfill needs a process polyfill which can't be resolved by webpack when using the new version of msw) - it would likely take some time to find out what's actually causing the issue there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions