optimize Error message of 'Only plain objects, and a few built-ins, can be passed to Server Actions. Classes or null prototypes are not supported.' #67158
Replies: 3 comments
-
Try calling onClick like this: onClick={() => login()} |
Beta Was this translation helpful? Give feedback.
-
Error: Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported. I am facing the same error but here i have different situation, here is server component which is passing props to a next server component, but i don;t know why next.js raising this error. import InventoryPage from "@/Components/Inventory"; const Inventory = async ({ searchParams }) => { return ( {!vehicles || !vehicles?.results?.length ? ( Fetching Vehicles... ) : ( )} ); }; export default Inventory; Note: here is InventoryPage is a server component too. |
Beta Was this translation helpful? Give feedback.
-
Error: Only plain objects, and a few built-ins, can be passed to Server Actions. Classes or null prototypes are not supported. import { z } from "zod"; /* --- helpers ------------------------------------------------------------ */ /* --- main schema -------------------------------------------------------- / /** Name */ /** Screenshot (exactly one image file) */ /** Plan (readonly in the UI but still validated) */ export const checkoutTier = async (userId: string, values: z.infer) => {
}; "use client"; const CheckoutForm = ({ name }: { name: string }) => {
} export default CheckoutForm; Browsor Console: WTF**, this error is that I want to see that file is uploaded and shown on the server console, and then upload it to the S3 bucket before on server action I don't want to upload it anywhere I want to send all the requested data on server then proceed and used it before don't |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
1.specific which line in code raise this error.
2.
3.
Non-Goals
Background
I am a green to nextjs and trying to use nextjs to create a to trigger a server action like this


<button onClick={login}>login</button>
. Everything works find until i click the button and receive the error on web page。It doesn't like the other error show which line rise the error, which make me spent much time on it.
I know more on how client component interactive with server component. Parameters need serialization.
I think this error can be expose in compiling period and point out the error line like the other error.
Proposal
I think not only me faced the same problem, point out the error line would be much more better.
Beta Was this translation helpful? Give feedback.
All reactions