Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Crypto - KeyObject is undefined for Node V14 - "jsonwebtoken": "9.0.0"

Open
#885 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, node.js
Domain
backend

Research direction

Reproduce the failure with jsonwebtoken 9.0.0 on Node v14.10.1 using the jwt.sign example. Start in sign.js at the KeyObject check around the reported line, and consider the issue done when the same signing call no longer throws a TypeError on that Node version.

Written by the indexing model from the issue text.

Description

Please do not report security vulnerabilities here. The Responsible Disclosure Program details the procedure for disclosing security issues.

Thank you in advance for helping us to improve this library! Please read through the template below and answer all relevant questions. Your additional work here is greatly appreciated and will help us respond as quickly as possible. For general support or usage questions, use the Auth0 Community or Auth0 Support. Finally, to avoid duplicates, please search existing Issues before submitting one here.

By submitting an Issue to this repository, you agree to the terms within the Auth0 Code of Conduct.

Description
KeyObject from Crypto is undefined. I am using Node 14.10.1. 
Reproduction

NODE v14.10.1
jwt.sign({email: "bar@foo"}, "PRIVATE_KEY", { algorithm: 'HS512' })

Throws an error
webpack-internal:///…ebtoken/sign.js:173 Uncaught (in promise) TypeError: Right-hand side of 'instanceof' is not an object
at module.exports [as sign] (sign.js:108:1)
if (secretOrPrivateKey != null && !(secretOrPrivateKey instanceof KeyObject)) {

image
Environment

Please provide the following:

  • Version of this library used: 9.0.0
  • Version of the platform or framework used, if applicable: any platform
  • Other relevant versions (language, server software, OS, browser):
  • Other modules/plugins/libraries that might be involved:
Dominant language
JavaScript
Stars
18.2k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from auth0/node-jsonwebtoken

All issues in auth0/node-jsonwebtoken

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.