Skip to content

[3.2.0-canary.1] TypeError: Cannot read property 'toString' of undefined #1007

@melanieseltzer

Description

@melanieseltzer

Describe the bug
Followed the example tutorial to get Google auth working. Every time I'd attempt signing in with my Google account, I'd get kicked back to the sign in page with a message saying "Try signing with a different account." and this error in the console:

[next-auth][error][oauth_callback_handler_error] TypeError: Cannot read property 'toString' of undefined
    at /Users/melanieseltzer/Sites/example/node_modules/next-auth/dist/server/routes/callback.js:115:32
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/melanieseltzer/Sites/example/node_modules/next-auth/dist/server/routes/callback.js:26:103)
    at _next (/Users/melanieseltzer/Sites/example/node_modules/next-auth/dist/server/routes/callback.js:28:194)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) 
https://next-auth.js.org/errors#oauth_callback_handler_error

id is not available as part of the user object (I only have name, email and image) so the code from this PR (user.id.toString()) is failing.

Is it expected or should it check first if user.id exists?

Works fine using v3.1.0 so I'll stay on that version for now.

Steps to reproduce
Install v3.2.0-canary.1 and follow example tutorial to authenticate with Google.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots or error logs

Screen Shot 2020-12-29 at 10 49 27 PM

Additional context
Add any other context about the problem here.

Feedback
Documentation refers to searching through online documentation, code comments and issue history. The example project refers to next-auth-example.

  • Found the documentation helpful
  • Found documentation but was incomplete
  • Could not find relevant documentation
  • Found the example project helpful
  • Did not find the example project helpful

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions