postgres node modules not found

I'm running into this error after I added an AuthButton component, i followed this tutorial to create the button https://www.youtube.com/watch?v=z2A9P1Zg1WM&t=485s I'm using create t3 with nextauth and connected to neon postgres db with drizzle AuthButton.server.tsx
import { SessionProvider } from "next-auth/react";
import { auth, BASE_PATH } from "~/server/auth";

import AuthButtonClient from "./AuthButton.client";

export default async function AuthButton() {
const session = await auth();
if (session && session.user) {
session.user = {
id: session.user.id,
};
}
return (
<SessionProvider basePath={BASE_PATH} session={session}>
<AuthButtonClient />
</SessionProvider>
);
}
import { SessionProvider } from "next-auth/react";
import { auth, BASE_PATH } from "~/server/auth";

import AuthButtonClient from "./AuthButton.client";

export default async function AuthButton() {
const session = await auth();
if (session && session.user) {
session.user = {
id: session.user.id,
};
}
return (
<SessionProvider basePath={BASE_PATH} session={session}>
<AuthButtonClient />
</SessionProvider>
);
}
AuthButton.client.tsx
"use client";

import { useSession } from "next-auth/react";
import { signIn, signOut } from "~/server/auth";
import { SidebarMenuButton } from "./ui/sidebar";
import { LogIn, LogOut } from "lucide-react";

export default function AuthButton() {
const session = useSession();
return session ? (
<SidebarMenuButton onClick={async () => await signOut()}>
<LogOut />
SignOut
</SidebarMenuButton>
) : (
<SidebarMenuButton onClick={async () => await signIn()}>
<LogIn />
SignIn
</SidebarMenuButton>
);
}
"use client";

import { useSession } from "next-auth/react";
import { signIn, signOut } from "~/server/auth";
import { SidebarMenuButton } from "./ui/sidebar";
import { LogIn, LogOut } from "lucide-react";

export default function AuthButton() {
const session = useSession();
return session ? (
<SidebarMenuButton onClick={async () => await signOut()}>
<LogOut />
SignOut
</SidebarMenuButton>
) : (
<SidebarMenuButton onClick={async () => await signIn()}>
<LogIn />
SignIn
</SidebarMenuButton>
);
}
im using the server component in my app
Jack Herrington
YouTube
Next-Auth v5 is Almost Here! Learn it Fast on the NextJS App Router...
Next-auth is an easy way to get started with authentication in your NextJS App Router application. Let's get it set up, and see how to secure routes, server actions, API routes and client and server API requests! Code: https://github.com/jherr/next-auth-v5 šŸ‘‰ Upcoming NextJS course: https://pronextjs.dev šŸ‘‰ Don't forget to subscribe to this chan...
No description
1 Reply
Sturlen
Sturlenā€¢3w ago
My guess is that you're importing your server code into a client component, since postgress should not normally be loaded on the client. this part of the docs might be useful to you: https://nextjs.org/docs/app/building-your-application/rendering/composition-patterns#keeping-server-only-code-out-of-the-client-environment
Rendering: Composition Patterns | Next.js
Recommended patterns for using Server and Client Components.

Did you find this page helpful?