#Nextjs 15 compatibility issues with Authjs

5 messages · Page 1 of 1 (latest)

fervent geyser
#

Hi everyone, I recently upgraded a project from nextjs 14 to the new next 15 and since then i've been getting this error while trying to get the session from authjs anywhere in my appication. Here im current getting the session on the layout file and thats is what's causing this error. i'm using authjs v5

This is the code of my layout file where i'm getting the session:

import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { SessionProvider } from "next-auth/react";
import { auth } from "@/auth";
import "./globals.css";
import { Toaster } from "@/components/ui/sonner";

const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};

export default async function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const session = await auth();

return (
<SessionProvider session={session}>
<html lang="en">
<body className={inter.className}>
<Toaster />
{children}
</body>
</html>
</SessionProvider>
);
}

Pls is there anything i can do to solve this error currently, or i should just stick to nextjs for now 14 while this issue is being fixed by authjs

plucky meteorBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

winged kettle
#

Which exact version of next-auth are you using atm? According to posts on Reddit it was fixed for next-auth 4.24.9 and next-auth 5.0.0-beta.25.

#

Nextjs 15 compatibility issues with Authjs

fervent geyser