Server Action With getServerSession
hi i am trying to use getServerSession from server action it giving me error
in terminal
in console(frontend)
code
can anyone tell me how can i resolve this issue?
error Error: Invariant: Method expects to have requestAsyncStorage, none available
at BuyProSubscription (pricing/buyNowAction.ts:15:86)
error Error: Invariant: Method expects to have requestAsyncStorage, none available
at BuyProSubscription (pricing/buyNowAction.ts:15:86)
Uncaught (in promise) Error: Invariant: Method expects to have requestAsyncStorage, none available
at headers (C:\Users\new\Documents\striver-sheet-website\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\client\components\headers.js:40:15)
at getServerSession (C:\Users\new\Documents\striver-sheet-website\node_modules\.pnpm\[email protected][email protected][email protected][email protected][email protected]\node_modules\next-auth\next\index.js:144:35)
Uncaught (in promise) Error: Invariant: Method expects to have requestAsyncStorage, none available
at headers (C:\Users\new\Documents\striver-sheet-website\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\client\components\headers.js:40:15)
at getServerSession (C:\Users\new\Documents\striver-sheet-website\node_modules\.pnpm\[email protected][email protected][email protected][email protected][email protected]\node_modules\next-auth\next\index.js:144:35)
"use server";
import { authOption } from "@/lib/auth";
import { getServerSession } from "next-auth";
import { redirect } from "next/navigation";
import { absoluteUrl } from "@/lib/utils";
export async function BuyProSubscription() {
const LoginURL = absoluteUrl("register-or-login?callback=%2Fpricing");
const session = await getServerSession(authOption);
console.log(session);
}
"use server";
import { authOption } from "@/lib/auth";
import { getServerSession } from "next-auth";
import { redirect } from "next/navigation";
import { absoluteUrl } from "@/lib/utils";
export async function BuyProSubscription() {
const LoginURL = absoluteUrl("register-or-login?callback=%2Fpricing");
const session = await getServerSession(authOption);
console.log(session);
}
0 Replies