When I run this code locally it works fine but when I deployed it to vercel am getting session.user.email is undefined. I am using GraphQL, Nexus and Prisma
t.field('createProject', {
type: 'Project',
args: {
name: nonNull(stringArg()),
description: nonNull(stringArg()),
website: stringArg(),
sourceCode: stringArg(),
// userId: stringArg(),
},
async resolve(_, args, ctx) {
// console.log(user)
try {
const req = ctx.req
const session = await getSession({ req })
// // console.log(session)
// const user = await ctx.prisma.user.findUnique({
// where: { email: session?.user.email },
// })
return ctx.prisma.project.create({
data: {
name: args.name,
description: args.description,
website: args.website,
user: { connect: { email: session?.user?.email } },
sourceCode: args.sourceCode,
},
})
} catch (error) {
console.log(error)
}
},
})