mshumayl / ai-daleel

AI Daleel source code.

Home Page:https://ai-daleel.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to transact into database

mshumayl opened this issue · comments

prisma:error 
Invalid `p.session.findUnique()` invocation in
Z:\Noconda\quran-gpt\quran-gpt\node_modules\@next-auth\prisma-adapter\dist\index.js:24:52

  21     where: { provider_providerAccountId },
  22 }),
  23 async getSessionAndUser(sessionToken) {
→ 24     const userAndSession = await p.session.findUnique(
Server has closed the connection.
[next-auth][error][adapter_error_getSessionAndUser]
https://next-auth.js.org/errors#adapter_error_getsessionanduser
Invalid `p.session.findUnique()` invocation in
Z:\Noconda\quran-gpt\quran-gpt\node_modules\@next-auth\prisma-adapter\dist\index.js:24:52

  21     where: { provider_providerAccountId },
  22 }),
  23 async getSessionAndUser(sessionToken) {
→ 24     const userAndSession = await p.session.findUnique(
Server has closed the connection. {
  message: '\n' +
    'Invalid `p.session.findUnique()` invocation in\n' +
    'Z:\\Noconda\\quran-gpt\\quran-gpt\\node_modules\\@next-auth\\prisma-adapter\\dist\\index.js:24:52\n' +
    '\n' +
    '  21     where: { provider_providerAccountId },\n' +
    '  22 }),\n' +
    '  23 async getSessionAndUser(sessionToken) {\n' +
    '→ 24     const userAndSession = await p.session.findUnique(\n' +
    'Server has closed the connection.',
  stack: 'Error: \n' +
    'Invalid `p.session.findUnique()` invocation in\n' +
    'Z:\\Noconda\\quran-gpt\\quran-gpt\\node_modules\\@next-auth\\prisma-adapter\\dist\\index.js:24:52\n' +
    '\n' +
    '  21     where: { provider_providerAccountId },\n' +
    '  22 }),\n' +
    '  23 async getSessionAndUser(sessionToken) {\n' +
    '→ 24     const userAndSession = await p.session.findUnique(\n' +
    'Server has closed the connection.\n' +
    '    at Zr.handleRequestError (Z:\\Noconda\\quran-gpt\\quran-gpt\\node_modules\\@prisma\\client\\runtime\\library.js:171:6414)\n' +
    '    at Zr.handleAndLogRequestError (Z:\\Noconda\\quran-gpt\\quran-gpt\\node_modules\\@prisma\\client\\runtime\\library.js:171:5948)\n' +
    '    at Zr.request (Z:\\Noconda\\quran-gpt\\quran-gpt\\node_modules\\@prisma\\client\\runtime\\library.js:171:5786)\n' +
    '    at async t._request (Z:\\Noconda\\quran-gpt\\quran-gpt\\node_modules\\@prisma\\client\\runtime\\library.js:174:10455)\n' +
    '    at async getSessionAndUser (Z:\\Noconda\\quran-gpt\\quran-gpt\\node_modules\\@next-auth\\prisma-adapter\\dist\\index.js:24:36)',
  name: 'Error'
}
[next-auth][error][SESSION_ERROR] 
https://next-auth.js.org/errors#session_error
Invalid `p.session.findUnique()` invocation in
Z:\Noconda\quran-gpt\quran-gpt\node_modules\@next-auth\prisma-adapter\dist\index.js:24:52

  21     where: { provider_providerAccountId },
  22 }),
  23 async getSessionAndUser(sessionToken) {
→ 24     const userAndSession = await p.session.findUnique(
Server has closed the connection. Error:
Invalid `p.session.findUnique()` invocation in
Z:\Noconda\quran-gpt\quran-gpt\node_modules\@next-auth\prisma-adapter\dist\index.js:24:52

  21     where: { provider_providerAccountId },
  22 }),
  23 async getSessionAndUser(sessionToken) {
→ 24     const userAndSession = await p.session.findUnique(
Server has closed the connection.
    at Zr.handleRequestError (Z:\Noconda\quran-gpt\quran-gpt\node_modules\@prisma\client\runtime\library.js:171:6414)
    at Zr.handleAndLogRequestError (Z:\Noconda\quran-gpt\quran-gpt\node_modules\@prisma\client\runtime\library.js:171:5948)
    at Zr.request (Z:\Noconda\quran-gpt\quran-gpt\node_modules\@prisma\client\runtime\library.js:171:5786)
    at async t._request (Z:\Noconda\quran-gpt\quran-gpt\node_modules\@prisma\client\runtime\library.js:174:10455)
    at async getSessionAndUser (Z:\Noconda\quran-gpt\quran-gpt\node_modules\@next-auth\prisma-adapter\dist\index.js:24:36) {
  name: 'GetSessionAndUserError',
  code: 'P1017'
}
❌ tRPC failed on db.addNote: UNAUTHORIZED

Not sure what fixed it, but I did the following:

  1. Logged into Supabase https://app.supabase.com/project/bgvcawhjgoqgeeuyajeu/ again.
  2. Reload the Supabase editor.
  3. Rerun npx prisma migrate dev

And I am now able to make a new transaction into Supabase.

It seems there was an issue with authentication. Not sure if it's from NextAuth.js.