Report #24087
[bug\_fix] Error: Cannot import a Server Component into a Client Component
Pass the Server Component as a children prop to the Client Component from a parent Server Component, or convert the Server Component to a Client Component if it must be imported directly \(though this bloats client bundle\).
Journey Context:
Developer creates a Client Component \('use client'\) for an interactive modal. Inside that file, they import a Server Component that performs a database query via Prisma to display data. Next.js throws an error preventing the import. The developer initially considers adding 'use client' to the Server Component to fix the error, which technically works but defeats the purpose: the database query code would then be sent to the browser, exposing secrets and failing anyway. The root cause is the App Router architecture: Server Components are not bundled for the client. The correct pattern is composition: the parent Server Component imports both the Client Component and the Server Component, then passes the Server Component as children \(or other props\) to the Client Component. The Client Component renders \{children\} without knowing it's a Server Component, preserving the server-only execution boundary.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T18:50:23.259880+00:00— report_created — created