grpc/grpc-node

Cannot find module 'node:dns' for NodeV12

vivek-singh-rathore opened this issue · 5 comments

Problem description

@grpc/grpc-js@1.12.0 breaking support for node v12.

Error: Cannot find module 'node:dns'
Require stack:
- /Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/resolver-dns.js
- /Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/http_proxy.js
- /Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/transport.js
- /Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/subchannel-pool.js
- /Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/internal-channel.js
- /Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/channel.js
- /Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/index.js
- /Users/test/grpc-node/[eval]
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/resolver-dns.js:20:20)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/resolver-dns.js',
    '/Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/http_proxy.js',
    '/Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/transport.js',
    '/Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/subchannel-pool.js',
    '/Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/internal-channel.js',
    '/Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/channel.js',
    '/Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/index.js',
    '/Users/test/grpc-node/[eval]'
  ]
}

Reproduction steps


mkdir grpc-node
cd grpc-node
nvm use 12.18.2
npm init -y
npm i @grpc/grpc-js
node -e 'require("@grpc/grpc-js")'

Environment

OS name, version and architecture: macOS
Node version v12.18.2
Node installation method nvm
Package name and version @grpc/grpc-js@1.12.0

This is fixed in version 1.12.1.

Hi @murgatroid99, using the same reproduction steps but on 1.12.1, this is the output :

Error: Cannot find module 'fs/promises'
Require stack:
- /Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/certificate-provider.js
- /Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/experimental.js
- /Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/index.js
- /Users/test/grpc-node/[eval]
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/certificate-provider.js:20:12)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/certificate-provider.js',
    '/Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/experimental.js',
    '/Users/test/grpc-node/node_modules/@grpc/grpc-js/build/src/index.js',
    '/Users/test/grpc-node/[eval]'
  ]
}

That is now fixed in 1.12.2.

Node 12 has been EoL since 2022-04-30. At what point will this library move minimum support of the mainline releases up from node 12 to something thats not dead?

I'm not making anybody use Node 12. I continue to support it because people are clearly still using it.