mshumayl / ai-daleel

AI Daleel source code.
https://ai-daleel.vercel.app
1 stars 0 forks source link

Invalid `prisma.savedSnippets.findMany()` invocation #15

Closed mshumayl closed 1 year ago

mshumayl commented 1 year ago

Server unexpectedly closes connection when running prisma.savedSnippets.findMany() (i.e. when retrieving previously bookmarked verses for current user).

This causes the user to log out from the whole app. Very bizarre.

❌ tRPC failed on db.saveSnippet: 
Invalid `prisma.savedSnippets.findMany()` invocation:

Server has closed the connection.
prisma:query BEGIN
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'
}
mshumayl commented 1 year ago

Solved by using global Prisma client https://github.com/mshumayl/quran-gpt/commit/c98822f86288eae17eae25bd24388e7878d973a3