Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(providers): add optional chaining to avoid nullish reference errors #4365

Merged
merged 2 commits into from Apr 14, 2022

Conversation

yisu-kim
Copy link
Contributor

Reasoning 💡

Hello, I encountered an error while using the Kakao provider.
If you don't select your nickname and profile image in Kakao settings, an 'undefined' error occurs because the profile object is not provided.

Please refer to the picture below.
Kakao developers
undefined error

As you can see in line 40 of the code, the profile is an optional property.
So I changed to get a nickname or profile image only if there is a profile object.

Checklist 🧢

- [ ] Documentation
- [ ] Tests

  • Ready to be merged

@vercel
Copy link

vercel bot commented Apr 10, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nextauthjs/next-auth/FKTW8BabsCjLiqsvPNJbxqnNVBLC
✅ Preview: https://next-auth-git-fork-yisu-kim-fix-kakao-provider-nextauthjs.vercel.app

@github-actions github-actions bot added core Refers to `@auth/core` providers labels Apr 10, 2022
Copy link
Collaborator

@ubbe-xyz ubbe-xyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🖤 , Typescript should have caught this: profile is currently typed as any here, we have a PR attempting to fix it #4202

@yisu-kim
Copy link
Contributor Author

That's a fundamental solution to the problem. Thank you for letting me know.

@vercel vercel bot temporarily deployed to Preview April 14, 2022 11:57 Inactive
Copy link
Member

@balazsorban44 balazsorban44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@balazsorban44 balazsorban44 merged commit 59daa0e into nextauthjs:main Apr 14, 2022
@yisu-kim yisu-kim deleted the fix/kakao-provider branch April 30, 2022 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Refers to `@auth/core` providers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants