We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
>=14 <14.18.0
apps with nodejs <14.18.0 have issues loading undici because of node: prefixed imports.
undici
node:
Just start a new project with a simple script
package.json
{ "name": "unidci-node-support", "version": "1.0.0", "description": "", "type": "commonjs", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "undici": "^5.28.1" } }
and index.js
index.js
const { request } = require('undici'); request('https://httpstat.us/200') .then((response) => { const { statusCode, headers, trailers, } = response; console.log('response received', statusCode) console.log('headers', headers) console.log('trailers', trailers) });
Then run it
nvm use v1.4.0.0 node index.js
The script runs and logs the statusCode, headers & trailers
The error
internal/modules/cjs/loader.js:1017 throw err; ^ Error: Cannot find module 'node:assert' Require stack: - /.../issues/unidci-node-support/node_modules/undici/lib/handler/RetryHandler.js - /.../issues/unidci-node-support/node_modules/undici/index.js - /.../issues/unidci-node-support/index.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1014:15) at Function.Module._load (internal/modules/cjs/loader.js:884:27) at Module.require (internal/modules/cjs/loader.js:1074:19) at require (internal/modules/cjs/helpers.js:72:18) at Object.<anonymous> (/Users/david/Documents/repos/issues/unidci-node-support/node_modules/undici/lib/handler/RetryHandler.js:1:16) at Module._compile (internal/modules/cjs/loader.js:1185:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10) at Module.load (internal/modules/cjs/loader.js:1034:32) at Function.Module._load (internal/modules/cjs/loader.js:923:14) at Module.require (internal/modules/cjs/loader.js:1074:19) { code: 'MODULE_NOT_FOUND', requireStack: [ '/.../issues/unidci-node-support/node_modules/undici/lib/handler/RetryHandler.js', '/.../issues/unidci-node-support/node_modules/undici/index.js', '/.../issues/unidci-node-support/index.js' ] }
os: MacOS Sonoma 14.1.1 nodejs: 14.0.0
Issue was found in one of our CI runs elastic/apm-agent-nodejs#3754 (comment)
The text was updated successfully, but these errors were encountered:
A solution might be to bump the supported node version to v14.18.0
v14.18.0
undici/package.json
Line 138 in 286bb44
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Bug Description
apps with nodejs <14.18.0 have issues loading
undici
because ofnode:
prefixed imports.Reproducible By
Just start a new project with a simple script
package.json
and
index.js
Then run it
Expected Behavior
The script runs and logs the statusCode, headers & trailers
Logs & Screenshots
The error
Environment
os: MacOS Sonoma 14.1.1
nodejs: 14.0.0
Additional context
Issue was found in one of our CI runs elastic/apm-agent-nodejs#3754 (comment)
The text was updated successfully, but these errors were encountered: