Skip to content

fix(prisma): import PrismaClientKnownRequestError for edge runtime compatibility#12755

Merged
ThangHuuVu merged 2 commits intonextauthjs:mainfrom
twinh:patch-2
May 9, 2025
Merged

fix(prisma): import PrismaClientKnownRequestError for edge runtime compatibility#12755
ThangHuuVu merged 2 commits intonextauthjs:mainfrom
twinh:patch-2

Conversation

@twinh
Copy link
Contributor

@twinh twinh commented Mar 10, 2025

☕️ Reasoning

Previously, PrismaClientKnownRequestError was imported from @prisma/client/runtime/library,

which is intended for Node.js and causes a runtime error ("TypeError: Cannot read properties of undefined (reading 'exec')") in edge environments.

This change imports it from @prisma/client to ensure proper functionality in edge runtime.

🧢 Checklist

  • Documentation
  • Tests
  • Ready to be merged

🎫 Affected issues

Fixes #12731

📌 Resources

@twinh twinh requested a review from ndom91 as a code owner March 10, 2025 09:02
@vercel
Copy link

vercel bot commented Mar 10, 2025

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 May 9, 2025 4:53am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview May 9, 2025 4:53am

@vercel
Copy link

vercel bot commented Mar 10, 2025

@twinh 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 Mar 10, 2025
@ThangHuuVu
Copy link
Member

thanks for the fix!

@codecov
Copy link

codecov bot commented May 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 39.26%. Comparing base (6a0fa0c) to head (f309a13).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12755      +/-   ##
==========================================
- Coverage   39.26%   39.26%   -0.01%     
==========================================
  Files         200      200              
  Lines       31643    31642       -1     
  Branches     1374     1380       +6     
==========================================
- Hits        12425    12424       -1     
  Misses      19218    19218              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ThangHuuVu ThangHuuVu merged commit c7409f3 into nextauthjs:main May 9, 2025
13 of 15 checks passed
@twinh twinh deleted the patch-2 branch May 13, 2025 08:39
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.

Runtime Error: Authentication crash when using PrismaAdapter (mongodb) - TypeError: Cannot read properties of undefined (reading 'exec')

2 participants