Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using jsonwebtoken with bun throws TypeError while signing new token #5378

Closed
MammadProMax opened this issue Sep 14, 2023 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@MammadProMax
Copy link

What version of Bun is running?

1.0.0

What platform is your computer?

Linux 6.2.0-32-generic x86_64 x86_64

What steps can reproduce the bug?

using this code in a simple express app built with bun

jwt.sign({ id: "xx" }, process.env.TOKEN_SECRET_KEY, { expiresIn: "1h", });

What is the expected behavior?

the expected bahavior is to provide a jwt token

What do you see instead?

instead i get the error down bellow

TypeError: Right hand side of instanceof is not an object
at /home/mohammad/Desktop/JWT auth/node_modules/jsonwebtoken/sign.js:114:38
at /home/mohammad/Desktop/JWT auth/app.js:25:0
at processTicksAndRejections (:1:2602)
109 |
110 | if (!secretOrPrivateKey && options.algorithm !== 'none') {
111 | return failure(new Error('secretOrPrivateKey must have a value'));
112 | }
113 |
114 | if (secretOrPrivateKey != null && !(secretOrPrivateKey instanceof KeyObject)) {
^

Additional information

No response

@MammadProMax MammadProMax added the bug Something isn't working label Sep 14, 2023
@sirenkovladd
Copy link
Contributor

Duplicate of #2036

@Electroid Electroid closed this as not planned Won't fix, can't repro, duplicate, stale Sep 14, 2023
@muchekechege
Copy link

why are you guys closing the issue with no solution

@userunknownn
Copy link

For me the workaround was downgrading jwt to 8.5.1, just as @AlexRoosWork replied on this issue:
auth0/node-jsonwebtoken#939

@Electroid
Copy link
Contributor

If you upgrade to Bun v1.0.5, the issue should be fixed. If you're still experiencing the same issue, we can re-open.

@userunknownn
Copy link

userunknownn commented Oct 11, 2023

If you upgrade to Bun v1.0.5, the issue should be fixed. If you're still experiencing the same issue, we can re-open.

I was on v1.0.0, I've just tested on v1.0.5, and it fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants