Next.js Discord

Discord Forum

Could not find module (shadcn Component) in the React Client Manifest

Unanswered
Common Goldeneye posted this in #help-forum
Open in Discord
Avatar
Common GoldeneyeOP
Working on NextJS 14.1.0 to build a portfolio project and came across this error trying to build a server component that utilizes a server action. Seen other posts with similar issue, but none of the solutions worked for me. Remove "use server" presents a different error pointing to my User schema, but thinking I need to keep this as I'm using getServerSession. Not sure how to go about a solution, so any help would be great if anyone's encountered this before.

"use server"

import {
  Avatar,
  AvatarFallback,
  AvatarImage,
} from "../../components/ui/avatar";
import { getServerSession } from "next-auth";
import { authOptions } from "@/app/api/auth/[...nextauth]/route";

const handleGetDiscussion = async (id: string) => {
  const res = await fetch(`http://localhost:3000/api/discussions/${id}`, {
    method: "GET",
  });

  const data = await res.json();

  return { discussion: data };
};

const DiscussionContent = async ({params}) => {
  const session = await getServerSession(authOptions);
  
  if (!session) {
    return;
  }

  const { discussion } = await handleGetDiscussion(params?.id as string);
  
  return (
    <Avatar className="w-10 h-10 border">
      <AvatarImage alt="@shadcn" src="/placeholder-user.jpg" />
      <AvatarFallback>AC</AvatarFallback>
    </Avatar>
  )
}
Image

0 Replies