The user is encountering a build failure when deploying their Next.js 15.2.4 project on Vercel. The issue stems from importing next/headers in a file located in the lib/ directory (./lib/supabase/server.ts), which is used by a component in the pages/ directory. This results in the following error:
Error: You’re importing a component that needs “next/headers”. That only works in a Server Component which is not supported in the pages/ directory.
The project uses the @supabase/ssr package for server-side Supabase authentication and is managed with pnpm@10.x. The user is aware that next/headers is only compatible with the App Router and not the Pages Router, which their project currently uses.
The project repository is available at: github.com/nicholas357/E-commerce-fullstack-2.0