getToken throws an error
See original GitHub issueDescribe the bug
After updating to 3.15.5
the following code throws an error
export default async function TruAPIHandler(
req: NextApiRequest,
res: NextApiResponse,
) {
// getToken will throw
const token = await getToken({
req,
secret: process.env.NEXTAUTH_SECRET,
encryption: true,
signingKey: process.env.NEXTAUTH_SIGNIN_KEY,
encryptionKey: process.env.NEXTAUTH_ENCRYPTION_KEY,
})
Steps to reproduce I’m using an encrypted JWT in my configuration
secret: process.env.NEXTAUTH_SECRET,
session: {
jwt: true,
},
jwt: {
encryption: true,
secret: process.env.NEXTAUTH_SECRET,
signingKey: process.env.NEXTAUTH_SIGNIN_KEY,
encryptionKey: process.env.NEXTAUTH_ENCRYPTION_KEY,
},
Simple repo to reproduce https://github.com/mtt87/next-auth-bug
Expected behavior
It should not throw an error and return the token as it happens correctly on 3.14.8
Screenshots or error logs
TypeError: Object(...) is not a function
at TruAPIHandler (webpack-internal:///./pages/api/tru/[...params].ts:9:85)
at apiResolver (/Users/mattia/node_modules/next/dist/next-server/server/api-utils.js:8:7)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async DevServer.handleApiRequest (/Users/mattia/node_modules/next/dist/next-server/server/next-server.js:67:462)
at async Object.fn (/Users/mattia/node_modules/next/dist/next-server/server/next-server.js:59:492)
at async Router.execute (/Users/mattia/node_modules/next/dist/next-server/server/router.js:25:67)
at async DevServer.run (/Users/mattia/node_modules/next/dist/next-server/server/next-server.js:69:1042)
at async DevServer.handleRequest (/Users/mattia/node_modules/next/dist/next-server/server/next-server.js:34:504)
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
[firebase_messaging] getToken() throws an exception in some ...
When running integration tests on Firebase Test Lab however, the call to getToken() sometimes throws an error and we have no idea why....
Read more >and FirebaseMessaging.instance.getToken() throws android ...
I found the issue. I'm living in Syria, and it has become forbidden to call getToken for the first time without a VPN,...
Read more >3036327 - Error "The request is malformed" throws when get ...
When try to get OAuth 2.0 token against AS Java, it end with error "The request is malformed". For example: When use Postman...
Read more >FirebaseMessaging.instance.getToken() throws ... - Reddit
By the way in IOS app works perfectly. When I try to get token it throws this error: E/FirebaseMessaging(21291): Failed to get FIS...
Read more >getToken() works in ASP.NET but throws Authentication error ...
I am able to get a token and receive messages when I use ASP.NET but when I try the same code in Vue...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The problem was something else, but I now verified locally that the new release fixed the problem!
🎉 This issue has been resolved in version 4.0.0-next.5 🎉
The release is available on:
Your semantic-release bot 📦🚀