Skip to content

lib: useless information in no crypto error stack #37593

Open
@jasnell

Description

@jasnell

Just noting this to get back around to it later... the no crypto support error stack is a bit unfortunate as it contains internal details that just aren't helpful for the user:

Really, anything above the node:crypto frame is useless information in these stacks (commonjs or ESM)

> require('crypto')
Uncaught Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto support
    at new NodeError (node:internal/errors:329:5)
    at assertCrypto (node:internal/util:128:11)
    at node:crypto:36:1
    at NativeModule.compileForInternalLoader (node:internal/bootstrap/loaders:283:7)
    at NativeModule.compileForPublicLoader (node:internal/bootstrap/loaders:225:10)
    at loadNativeModule (node:internal/modules/cjs/helpers:39:9)
    at Function.Module._load (node:internal/modules/cjs/loader:787:15)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at REPL1:1:1 {
  code: 'ERR_NO_CRYPTO'
}
> .exit
root@DESKTOP-5KK9VIR:~/node/node-check# ./node ../tmp/a.mjs
node:internal/process/esm_loader:74
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto support
    at new NodeError (node:internal/errors:329:5)
    at assertCrypto (node:internal/util:128:11)
    at node:crypto:36:1
    at NativeModule.compileForInternalLoader (node:internal/bootstrap/loaders:283:7)
    at NativeModule.compileForPublicLoader (node:internal/bootstrap/loaders:225:10)
    at loadNativeModule (node:internal/modules/cjs/helpers:39:9)
    at Loader.builtinStrategy (node:internal/modules/esm/translators:285:18)
    at new ModuleJob (node:internal/modules/esm/module_job:44:26)
    at Loader.getModuleJob (node:internal/modules/esm/loader:246:11)
    at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:59:21) {
  code: 'ERR_NO_CRYPTO'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    cryptoIssues and PRs related to the crypto subsystem.errorsIssues and PRs related to JavaScript errors originated in Node.js core.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions