0Auth issue
Unanswered
Asian black bear posted this in #help-forum
Asian black bearOP
i am trying to authenticate my application in users route with 0auth but after authentication it stuck on authentication of google but in home page login it works well, anybody can help me out ?
35 Replies
@Dutch any code shows that ?
Asian black bearOP
which part of code should i share ?
@Asian black bear which part of code should i share ?
Dutch
does oauth and have problems
or share a live share vscode link to look in depth
f1 > start collab ...
are you using next-auth
or authjs
(v4) or (v5)
Asian black bearOP
v5
auth.js
Asian black bearOP
no no, in auth.js there is next-auth, or are they some older versions ?
@tsa i can see it works fine tho, wdym by stuck in auth
Asian black bearOP
didn't you see i am stuck on the authentication for users route ?
ah
can you share the auth config
Asian black bearOP
yup
import NextAuth, { NextAuthOptions } from "next-auth"
import GoogleProvider from "next-auth/providers/google";
//for prisma adapters
import { PrismaAdapter } from "@auth/prisma-adapter"
import { prisma } from "@/prisma/client";
//storing object in export const, so that we can use ths object outside of module.
export const authOptions : NextAuthOptions = {
adapter: PrismaAdapter(prisma),
providers : [
GoogleProvider( {
clientId: process.env.GOOGLE_CLIENT_ID "",
clientSecret: process.env.GOOGLE_CLIENT_SECRET ""
})
],
session: {
strategy: "database"
}
}
const handler = NextAuth(authOptions);
export { handler as GET, handler as POST };
import GoogleProvider from "next-auth/providers/google";
//for prisma adapters
import { PrismaAdapter } from "@auth/prisma-adapter"
import { prisma } from "@/prisma/client";
//storing object in export const, so that we can use ths object outside of module.
export const authOptions : NextAuthOptions = {
adapter: PrismaAdapter(prisma),
providers : [
GoogleProvider( {
clientId: process.env.GOOGLE_CLIENT_ID "",
clientSecret: process.env.GOOGLE_CLIENT_SECRET ""
})
],
session: {
strategy: "database"
}
}
const handler = NextAuth(authOptions);
export { handler as GET, handler as POST };
do you get a next-redirect error in the logs
Asian black bearOP
nope
@Asian black bear nope
it'd be great if you could share a repro example
csb's fine
Asian black bearOP
sorry
what do you mean by that ?
@Asian black bear what do you mean by that ?
reproduction example / codebase, with CodeSandBox
Asian black bearOP
okay, thanks, now, how could i do that ?
@Asian black bear okay, thanks, now, how could i do that ?
well, you could import your code into a codesandbox
or create a minimal repro example
@tsa well, you could import your code into a codesandbox
Asian black bearOP
okay, i will share my live link, in DM
@Asian black bear import NextAuth, { NextAuthOptions } from "next-auth"
import GoogleProvider from "next-auth/providers/google";
//for prisma adapters
import { PrismaAdapter } from "@auth/prisma-adapter"
import { prisma } from "@/prisma/client";
//storing object in export const, so that we can use ths object outside of module.
export const authOptions : NextAuthOptions = {
adapter: PrismaAdapter(prisma),
providers : [
GoogleProvider( {
clientId: process.env.GOOGLE_CLIENT_ID || "",
clientSecret: process.env.GOOGLE_CLIENT_SECRET || ""
})
],
session: {
strategy: "database"
}
}
const handler = NextAuth(authOptions);
export { handler as GET, handler as POST };
Crucian carp
hey why I get this issue
TypeError: Cannot read properties of undefined (reading 'exec')
at [project]/node_modules/.pnpm/@prisma+client@6.5.0_prisma_fccffc52d17c43efe09300db03dc4958/node_modules/@prisma/client/runtime/library.js [middleware-edge] (ecmascript) (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\56765_@prisma_client_e066adf5._.js:1323:39)
at <unknown> (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:709:27)
at runModuleExecutionHooks (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:755:9)
at instantiateModule (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:707:9)
at getOrInstantiateModuleFromParent (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:640:12)
at esmImport (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:143:20)
at [project]/node_modules/.pnpm/@auth+prisma-adapter@2.8.0__91c94e2430087d46e8771b27e46e02b0/node_modules/@auth/prisma-adapter/index.js [middleware-edge] (ecmascript) (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\node_modules__pnpm_f94aa597._.js:11:293)
at <unknown> (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:709:27)
at runModuleExecutionHooks (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:755:9)
at instantiateModule (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:707:9)
I use prisma with mongo db
@Crucian carp hey why I get this issue
TypeError: Cannot read properties of undefined (reading 'exec')
at [project]/node_modules/.pnpm/@prisma+client@6.5.0_prisma_fccffc52d17c43efe09300db03dc4958/node_modules/@prisma/client/runtime/library.js [middleware-edge] (ecmascript) (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\56765_@prisma_client_e066adf5._.js:1323:39)
at <unknown> (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:709:27)
at runModuleExecutionHooks (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:755:9)
at instantiateModule (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:707:9)
at getOrInstantiateModuleFromParent (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:640:12)
at esmImport (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:143:20)
at [project]/node_modules/.pnpm/@auth+prisma-adapter@2.8.0__91c94e2430087d46e8771b27e46e02b0/node_modules/@auth/prisma-adapter/index.js [middleware-edge] (ecmascript) (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\node_modules__pnpm_f94aa597._.js:11:293)
at <unknown> (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:709:27)
at runModuleExecutionHooks (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:755:9)
at instantiateModule (file://D:\MDS\M1\CODE\PWA\price-buddy\price-buddy-v0\.next\server\edge\chunks\edge-wrapper_2dac3f70.js:707:9)
Tan
https://github.com/nextauthjs/next-auth/issues/12731#issuecomment-2698961955
pnpm install @auth/prisma-adapter@2.7.2
will solve it
pnpm install @auth/prisma-adapter@2.7.2
will solve it