TypeError: Right hand side of instanceof is not an object
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
- bun, javascript, node.js, typescript
- Domain
- api, authentication, backend
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from auth0/node-jsonwebtoken
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
auth0/node-jsonwebtoken#1042 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
auth0/node-jsonwebtoken#1000 · 2 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 65/100
auth0/node-jsonwebtoken#1046 ·
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
auth0/node-jsonwebtoken#1034 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
auth0/node-jsonwebtoken#1032 ·
All issues in auth0/node-jsonwebtoken
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
mksglu/context-mode#1200 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
neondatabase/website#5944 ·
-
module: core
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
bigbluebutton/bigbluebutton#25849 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
jaegertracing/jaeger-ui#4506 ·