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(prisma): replace select with include for user relation query #12434

Merged
merged 2 commits into from
Dec 29, 2024

Conversation

mcorbelli
Copy link
Contributor

This PR fixes an issue where Prisma's select statement was incorrectly used to query the user relation in the Account model. Since select is only applicable for scalar fields, this caused Prisma to throw an error:
Unknown field 'user' for select statement on model 'Account'.

The fix replaces select: { user: true } with include: { user: true }, which correctly fetches the user relation and resolves the issue.

@mcorbelli mcorbelli requested a review from ndom91 as a code owner December 28, 2024 23:33
Copy link

vercel bot commented Dec 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 29, 2024 9:48am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Dec 29, 2024 9:48am

Copy link

vercel bot commented Dec 28, 2024

@mcorbelli is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added adapters Changes related to the core code concerning database adapters prisma @auth/prisma-adapter labels Dec 28, 2024
Copy link

codecov bot commented Dec 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 39.38%. Comparing base (9dbc9ba) to head (e7120ff).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #12434   +/-   ##
=======================================
  Coverage   39.38%   39.38%           
=======================================
  Files         194      194           
  Lines       30676    30676           
  Branches     1341     1341           
=======================================
  Hits        12081    12081           
  Misses      18595    18595           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ndom91 ndom91 left a comment

Choose a reason for hiding this comment

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

Hmm yeah that's definitely not right. I guess we didn't require the result of that function for anything critical 😅

Tests pass, so LGTM 🙏

@ndom91 ndom91 merged commit 6bd0f96 into nextauthjs:main Dec 29, 2024
13 of 15 checks passed
@mcorbelli mcorbelli deleted the prisma-adapter branch December 29, 2024 20:06
@mcorbelli
Copy link
Contributor Author

When will it be included in the npm release? Is there a date yet? @ndom91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Changes related to the core code concerning database adapters prisma @auth/prisma-adapter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants