Next-auth: UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of undefined

Created on 3 Sep 2020  路  5Comments  路  Source: nextauthjs/next-auth

I am trying to setup Next Auth with MongoDB and I have everything set up, but I keep getting the errors below when I tried to visit the sign-in page or page auth pages:

UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of undefined

Screen Shot 2020-09-03 at 11 38 43 AM

Any help why this is happening and how to fix it.

help wanted question

Most helpful comment

ughhhhh I just spent a while because my file was called [...nextAuth].js

All 5 comments

Hi there!

Do you have a file called [...nextauth].js in pages/api/auth?

I suspect not that is causing the error (maybe it's called something else?)

We could definitely handle this error better!

ughhhhh I just spent a while because my file was called [...nextAuth].js

@aksperiod Ugh! Thanks for the feedback. That sounds like something we should catch, especially if multiple folks are running into it. Would be good to leave this open until there is PR or a ticket to capture the work to resolve it.

(e.g. display error / warning on console)

@iaincollins Yh I got it fixed. Thanks.

Awesome!

I've written this up as a feature request in #647 so we can help folks avoid running into this in future.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jimmiejackson414 picture jimmiejackson414  路  3Comments

ryanbahan picture ryanbahan  路  3Comments

iaincollins picture iaincollins  路  3Comments

benoror picture benoror  路  3Comments

eatrocks picture eatrocks  路  3Comments