import { auth } from "@/auth";
const page = async ({children}) => {
const session = await auth();
return <div>{children}</>
};
// My auth config
import { Pool } from "@neondatabase/serverless";
import NextAuth from "next-auth";
import PostgresAdapter from "@auth/pg-adapter";
import { authConfig } from "./auth.config";
export const { handlers, auth, signIn, signOut } = NextAuth(() => {
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
return {
adapter: PostgresAdapter(pool),
trustHost: true,
...authConfig,
};
});
The session is null on login.
While the client-side object remains consistently valid, the issue is on server-side pages. Only occasionally, the session is populated during page navigation.
What am I missing?
I’m using “next-auth”: “5.0.0-beta.20”.
Tried downgrading to earlier versions, it did not help.
1