-
Hello there! I'm trying to validate a JWT in a Next 12's middleware, as described by this example. However, both the repo example and my implementation throw errors. This is my code in short. import { jwtVerify } from 'jose';
const token = request.cookies.token;
const secret = new TextEncoder().encode(process.env.JWT_SECRET);
const verified = await jwtVerify(token, secret); And it throws this error:
Vercel's code, however, throws this error:
For the sake of testing, the JWT_SECRET environment variable is a simple string like Any idea on how to solve this? |
Beta Was this translation helpful? Give feedback.
Answered by
panva
Nov 23, 2021
Replies: 1 comment 1 reply
-
This was an upsteam bug in next.js and was fixed in https://github.com/vercel/next.js/releases/tag/v12.0.4 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
LuckeeDev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was an upsteam bug in next.js and was fixed in https://github.com/vercel/next.js/releases/tag/v12.0.4