fix: revert adapter session stubbing that broke session loading

The custom adapter wrapper that stubbed session methods was preventing
sessions from loading. Reverted to plain PrismaAdapter - the original
credentials login issue was caused by missing DB columns, not the adapter.

v1.51.6

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
mARTin 2026-03-19 22:21:57 +01:00
parent a1f6166eb5
commit c4214304af
2 changed files with 2 additions and 19 deletions

View File

@ -1,6 +1,6 @@
{
"name": "my-weekly-todo-list",
"version": "1.51.5",
"version": "1.51.6",
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
"main": "index.js",
"scripts": {

View File

@ -1,5 +1,4 @@
import { NextAuthOptions } from "next-auth";
import type { Adapter } from "next-auth/adapters";
import GoogleProvider from "next-auth/providers/google";
import AzureADProvider from "next-auth/providers/azure-ad";
import AppleProvider from "next-auth/providers/apple";
@ -8,24 +7,8 @@ import CredentialsProvider from "next-auth/providers/credentials";
import { compare } from "bcryptjs";
import { prisma } from "@/lib/prisma";
// Wrap PrismaAdapter to prevent session creation for credentials provider
// (known NextAuth v4 issue: adapter tries to create DB session even with JWT strategy)
const prismaAdapter = PrismaAdapter(prisma) as Adapter;
const adapter: Adapter = {
...prismaAdapter,
createUser: prismaAdapter.createUser,
getUser: prismaAdapter.getUser,
getUserByEmail: prismaAdapter.getUserByEmail,
getUserByAccount: prismaAdapter.getUserByAccount,
linkAccount: prismaAdapter.linkAccount,
createSession: () => { return null as any; },
getSessionAndUser: () => { return null as any; },
updateSession: () => { return null as any; },
deleteSession: () => { return null as any; },
};
export const authOptions: NextAuthOptions = {
adapter,
adapter: PrismaAdapter(prisma),
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID || "",