Next.js Discord

Discord Forum

Unhandled Promise Rejection: Error: Invariant: headers() expects to have requestAsyncStorage

Answered
Plott Hound posted this in #help-forum
Open in Discord
Plott HoundOP
In the latest next-auth and prisma-adapter:

import { getServerSession } from "next-auth";
import { authOptions } from "@/db/authOptions";

export default async function SidebarUserInfo() {
    const session = await getServerSession(authOptions);
    return (
        <div className="absolute bottom-0 left-0 right-0 p-3">
            {JSON.stringify(session, null, 2)}
        </div>
    )
}

this is correctly returning the data but in the console i'm getting:
Unhandled Promise Rejection: Error: Invariant: headers() expects to have requestAsyncStorage, none available.
Warning: An error occurred during hydration. The server HTML was replaced with client content in <#document>.
Error: Unknown root exit status.

"@auth/prisma-adapter": "^1.0.6",
"@prisma/client": "^5.5.2",
"next-auth": "^4.24.5",
"next": "14.0.2",
Answered by Plott Hound
fixed. i was being stupid and forgot its parent was a client component
View full answer

1 Reply

Plott HoundOP
fixed. i was being stupid and forgot its parent was a client component
Answer