getServerSession() is working fine locally but not in production.
Unanswered
Longtail tuna posted this in #help-forum
Longtail tunaOP
import { getServerSession } from 'next-auth';
import { getData } from '@/app/util/api';
import { authOptions } from '@/pages/api/auth/[...nextauth]';
const session = await getServerSession(authOptions);
let data = await getData(
The error I'm getting is
Error: An error occurred in the Server Components render,
and also an internal server error 500
import { getData } from '@/app/util/api';
import { authOptions } from '@/pages/api/auth/[...nextauth]';
const session = await getServerSession(authOptions);
let data = await getData(
api/get-category-challenges/${session?.userDbId}/${params.id}?status=${params.status});The error I'm getting is
Error: An error occurred in the Server Components render,
and also an internal server error 500
2 Replies
Longtail tunaOP
Actually it's written in documentation that we can use getServerSession in server components, and I'm using app directory
It's behaving weirdly sometimes it works, sometimes it doesn't.