Next.js Discord

Discord Forum

Prisma and NextJS route api error: Only plain objects, and a few built-ins, can be passed

Unanswered
Asiatic Lion posted this in #help-forum
Open in Discord
Avatar
Asiatic LionOP
I am using NextJS and Prisma and this is the error that it shows: Error: Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported.

Im getting the error when submitting the user onboarding form:


src/app/auth/onboarding/page.tsx:
'use server';
import { auth } from '@/auth';
import { getListOfSchools } from '../../api/server';
import { Session } from 'next-auth';
import OnboardingForm from '@/components/onboarding/OnboardingForm';

const OnboardingPage = async ({
  searchParams,
}: {
  searchParams: { [key: string]: string | string[] | undefined };
}) => {
  const email: string | undefined = searchParams.email as string | undefined;
  const session: Session | null = await auth();
  const emailSignUp: boolean = !session && !!email;

  const schools = await getListOfSchools();

  return (
    <>
      <OnboardingForm
        user={session ? session.user : null}
        emailSignUp={emailSignUp ? true : false}
        email={session ? session.user.email : email}
        schools={schools ? schools : []}
      />
    </>
  );
};

export default OnboardingPage;



src/componenets/onboarding/onboardingForm.tsx:
see attached file
Image

0 Replies