Report #44029
[bug\_fix] Passing non-serializable props \(functions, class instances, or Date objects\) from Server Component to Client Component fails.
Pass only serializable data \(plain objects, arrays, primitives\) across the Server/Client boundary, and reconstruct complex objects or functions inside the Client Component. The root cause is that Server Components execute on the server and pass props to Client Components via a JSON-like serialization; functions and class instances cannot be serialized across the network boundary.
Journey Context:
Developer fetches data in a Server Component using a Prisma query: \`const user = await prisma.user.findUnique\(\{ where: \{ id \} \}\)\`. The returned \`user\` is a Prisma model instance with methods like \`toJSON\(\)\` and internal state. Developer passes this directly to a Client Component: \`\` where UserCard.tsx has 'use client'. Next.js throws an error: 'Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Objects with toJSON are not supported.' Developer tries to work around by spreading the object \`\{...user\}\`, but this might still include non-serializable nested objects or lose methods. The correct debugging path is to realize that the Server/Client boundary is a serialization boundary, similar to an API route. The developer must map the Prisma result to a plain object: \`const plainUser = \{ id: user.id, name: user.name, email: user.email \};\` and pass that. If the Client Component needs to call a function \(like \`updateUser\`\), that function must be defined inside the Client Component \(calling an API route\), not passed as a prop from the server.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:22:23.503143+00:00— report_created — created