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

TypeError: Right hand side of instanceof is not an object

Open
#939 15 comments 11 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

Research direction

Start at the reported call in index.ts:48 and the failing check in node_modules/jsonwebtoken/sign.js:108. Compare token generation with jsonwebtoken 8.5.1, 9.0.0, and 9.0.2 under Bun and TypeScript, then rerun the reported registration request. Done means the valid jwt.sign call produces a token without the instanceof TypeError in the reported setup.

Written by the indexing model from the issue text.

Description

jsonwebtoken@9.0.0 => jsonwebtoken@9.0.2
bunjs typescript

When generating a token using the jsonwebtoken library instead of returning a valid token it returns an error:
103 | 104 | if (!secretOrPrivateKey && options.algorithm !== 'none') { 105 | return failure(new Error('secretOrPrivateKey must have a value')); 106 | } 107 | 108 | if (secretOrPrivateKey != null && !(secretOrPrivateKey instanceof KeyObject)) { ^ TypeError: Right hand side of instanceof is not an object at /home/d/Desktop/smth/v5/node_modules/jsonwebtoken/sign.js:108:38 at /home/d/Desktop/smth/v5/index.ts:48:32 at processTicksAndRejections (:1:2602) POST - http://localhost:8080/api/auth/register failed

Using valid code: const token = await jwt.sign({ username: username }, jwtSecret);

Returns a jwt token on versions prior to 9.0.0, preferably 8.5.1 works without issues.

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.