Skip to content

Tests broken with externalized undici #58865

Open
@richardlau

Description

@richardlau

Version

24.3.0, 22.17.0

Platform

Linux

Subsystem

No response

What steps will reproduce the bug?

To reproduce:

  1. Clone https://github.com/nodejs/undici.
  2. Build undici with EXTERNAL_PATH environment variable set. e.g.
EXTERNAL_PATH=/home/rlau/sandbox/github/undici node build/wasm.js --docker
  1. Delete deps/undici from Node.js (downstream builders such as Fedora do this to ensure the externalized version of undici is being used instead of the in-tree copy in Node.js).
  2. Configure Node.js to use the externalized undici from step 2 (note that loader.js is generated during step 2.).
./configure --shared-builtin-undici/undici-path /home/rlau/sandbox/github/undici/loader.js
  1. Build Node.js and run tests.

How often does it reproduce? Is there a required condition?

Every time

What is the expected behavior? Why is that the expected behavior?

Tests pass on all supported release lines of Node.js.

What do you see instead?

For Node.js 22, this test fails:
https://github.com/nodejs/undici/actions/runs/15926591410/job/44925161073

=== release test-inspector-network-fetch ===
Path: parallel/test-inspector-network-fetch
--- stderr ---
Debugger listening on ws://127.0.0.1:43805/7add9ccb-dd3b-471d-bf52-d3b5e0431cc1
For help, see: https://nodejs.org/en/docs/inspector
node:internal/modules/cjs/loader:1404
  throw err;
  ^

Error: Cannot find module '../../deps/undici/src/index.js'
Require stack:
- /home/runner/work/undici/undici/node-v22.17.0/test/parallel/test-inspector-network-fetch.js
    at Function._resolveFilename (node:internal/modules/cjs/loader:1401:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1057:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1062:22)
    at Function._load (node:internal/modules/cjs/loader:1211:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1487:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.<anonymous> (/home/runner/work/undici/undici/node-v22.17.0/test/parallel/test-inspector-network-fetch.js:15:16)
    at Module._compile (node:internal/modules/cjs/loader:1730:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/work/undici/undici/node-v22.17.0/test/parallel/test-inspector-network-fetch.js'
  ]
}

Node.js v22.17.0
Command: out/Release/node --inspect=0 --experimental-network-inspection --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /home/runner/work/undici/undici/node-v22.17.0/test/parallel/test-inspector-network-fetch.js

For Node.js 24,
https://github.com/nodejs/undici/actions/runs/15926591410/job/44925161078

=== release test-http-proxy-fetch ===
Path: parallel/test-http-proxy-fetch
--- stderr ---
node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
    ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected

  {
+   code: 1,
-   code: 0,
    signal: null,
+   stderr: 'node:internal/assert:11\n' +
+     '    throw new ERR_INTERNAL_ASSERTION(message);\n' +
+     '    ^\n' +
+     '\n' +
+     'Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.\n' +
+     'Please open an issue with this stack trace at https://github.com/nodejs/node/issues\n' +
+     '\n' +
+     '    at assert (node:internal/assert:11:11)\n' +
+     '    at setupUserModules (node:internal/process/pre_execution:187:3)\n' +
+     '    at prepareExecution (node:internal/process/pre_execution:159:5)\n' +
+     '    at prepareMainThreadExecution (node:internal/process/pre_execution:46:10)\n' +
+     '    at node:internal/main/run_main_module:15:19 {\n' +
+     "  code: 'ERR_INTERNAL_ASSERTION'\n" +
+     '}\n' +
+     '\n' +
+     'Node.js v24.3.0',
+   stdout: ''
-   stderr: '',
-   stdout: 'Hello world'
  }

    at exports.checkProxiedRequest (/home/runner/work/undici/undici/node-v24.3.0/test/common/proxy-server.js:89:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async /home/runner/work/undici/undici/node-v24.3.0/test/parallel/test-http-proxy-fetch.js:39:3 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: {
    stderr: 'node:internal/assert:11\n' +
      '    throw new ERR_INTERNAL_ASSERTION(message);\n' +
      '    ^\n' +
      '\n' +
      'Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.\n' +
      'Please open an issue with this stack trace at https://github.com/nodejs/node/issues\n' +
      '\n' +
      '    at assert (node:internal/assert:11:11)\n' +
      '    at setupUserModules (node:internal/process/pre_execution:187:3)\n' +
      '    at prepareExecution (node:internal/process/pre_execution:159:5)\n' +
      '    at prepareMainThreadExecution (node:internal/process/pre_execution:46:10)\n' +
      '    at node:internal/main/run_main_module:15:19 {\n' +
      "  code: 'ERR_INTERNAL_ASSERTION'\n" +
      '}\n' +
      '\n' +
      'Node.js v24.3.0',
    stdout: '',
    code: 1,
    signal: null
  },
  expected: { stderr: '', code: 0, signal: null, stdout: 'Hello world' },
  operator: 'deepStrictEqual'
}

Node.js v24.3.0
Command: out/Release/node --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /home/runner/work/undici/undici/node-v24.3.0/test/parallel/test-http-proxy-fetch.js
=== release test-https-proxy-fetch ===
Path: parallel/test-https-proxy-fetch
--- stderr ---
node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
    ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected

  {
+   code: 1,
-   code: 0,
    signal: null,
+   stderr: 'node:internal/assert:11\n' +
+     '    throw new ERR_INTERNAL_ASSERTION(message);\n' +
+     '    ^\n' +
+     '\n' +
+     'Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.\n' +
+     'Please open an issue with this stack trace at https://github.com/nodejs/node/issues\n' +
+     '\n' +
+     '    at assert (node:internal/assert:11:11)\n' +
+     '    at setupUserModules (node:internal/process/pre_execution:187:3)\n' +
+     '    at prepareExecution (node:internal/process/pre_execution:159:5)\n' +
+     '    at prepareMainThreadExecution (node:internal/process/pre_execution:46:10)\n' +
+     '    at node:internal/main/run_main_module:15:19 {\n' +
+     "  code: 'ERR_INTERNAL_ASSERTION'\n" +
+     '}\n' +
+     '\n' +
+     'Node.js v24.3.0',
+   stdout: ''
-   stderr: '',
-   stdout: 'Hello world'
  }

    at exports.checkProxiedRequest (/home/runner/work/undici/undici/node-v24.3.0/test/common/proxy-server.js:89:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async /home/runner/work/undici/undici/node-v24.3.0/test/parallel/test-https-proxy-fetch.js:43:3 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: {
    stderr: 'node:internal/assert:11\n' +
      '    throw new ERR_INTERNAL_ASSERTION(message);\n' +
      '    ^\n' +
      '\n' +
      'Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.\n' +
      'Please open an issue with this stack trace at https://github.com/nodejs/node/issues\n' +
      '\n' +
      '    at assert (node:internal/assert:11:11)\n' +
      '    at setupUserModules (node:internal/process/pre_execution:187:3)\n' +
      '    at prepareExecution (node:internal/process/pre_execution:159:5)\n' +
      '    at prepareMainThreadExecution (node:internal/process/pre_execution:46:10)\n' +
      '    at node:internal/main/run_main_module:15:19 {\n' +
      "  code: 'ERR_INTERNAL_ASSERTION'\n" +
      '}\n' +
      '\n' +
      'Node.js v24.3.0',
    stdout: '',
    code: 1,
    signal: null
  },
  expected: { stderr: '', code: 0, signal: null, stdout: 'Hello world' },
  operator: 'deepStrictEqual'
}

Node.js v24.3.0
Command: out/Release/node --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /home/runner/work/undici/undici/node-v24.3.0/test/parallel/test-https-proxy-fetch.js
=== release test-inspector-network-fetch ===
Path: parallel/test-inspector-network-fetch
--- stderr ---
Debugger listening on ws://127.0.0.1:42081/5b84e2a3-7770-4357-8970-7a0a5f457a0f
For help, see: https://nodejs.org/en/docs/inspector
node:internal/modules/cjs/loader:1372
  throw err;
  ^

Error: Cannot find module '../../deps/undici/src/index.js'
Require stack:
- /home/runner/work/undici/undici/node-v24.3.0/test/parallel/test-inspector-network-fetch.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1369:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22)
    at Module._load (node:internal/modules/cjs/loader:1179:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1449:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.<anonymous> (/home/runner/work/undici/undici/node-v24.3.0/test/parallel/test-inspector-network-fetch.js:15:16)
    at Module._compile (node:internal/modules/cjs/loader:16[92](https://github.com/nodejs/undici/actions/runs/15926591410/job/44925161078#step:13:93):14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/work/undici/undici/node-v24.3.0/test/parallel/test-inspector-network-fetch.js'
  ]
}

Node.js v24.3.0
Command: out/Release/node --inspect=0 --experimental-network-inspection --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /home/runner/work/undici/undici/node-v24.3.0/test/parallel/test-inspector-network-fetch.js

i.e.

  • parallel/test-http-proxy-fetch.js (Node.js 24)
  • parallel/test-https-proxy-fetch.js (Node.js 24)
  • parallel/test-inspector-network-fetch.js (Node.js 22, 24)

Additional information

When building Node.js with an externalized copy of undici, some tests fail. This was noticed on https://github.com/nodejs/undici/: nodejs/undici#4276

e.g. https://github.com/nodejs/undici/actions/runs/15926591410

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