example code error `UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'protection' of undefined`
See original GitHub issueYour question I tried example code, in my project, I got this error.
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'protection' of undefined
I just copied it except omitting the database. What should I fix?
What are you trying to do I want to authenticate on Github.
Reproduction node v14.13.0 yarn 1.22.10 next 10.0.6 next-auth 3.14.1
// /src/pages/api/auth/[...nextauth].ts
import NextAuth from 'next-auth'
import Providers from 'next-auth/providers'
export default NextAuth({
// Configure one or more authentication providers
providers: [
Providers.GitHub({
clientId: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET,
}),
],
})
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:6 (1 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'cache' of undefined - Stack ...
but once run with this line included, I get this error. (node:10388) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'cache' ...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError: Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an undefined...
Read more >What is "TypeError: Cannot read property 'state' of undefined"?
The error message says that you don't have the state property on an undefined object. To decode this, we have to understand the...
Read more >How To Fix Cannot read Property '0' of Undefined in JS
It happens to the best of us. Double check your code and make sure that the array, string, or object literal you are...
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
Temporal solution to keep working before merge of the fix, you can go to
/node_modules/next-auth/dist/server/index.js:128
and addprovider && ...
manually on the ifStarted having this error all of a sudden. Manually edited check for
provider
as proposed by @dcolonv’s PR just to keep working. Hoping it will be merged soon.