Error with Effect.tryPromise in Next.js

Hey guys I have a simple setup with effect and nextjs where I try run an Effect.tryPromise from a server action, but it is giving me a weird error

Uncaught (in promise) 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.


"use client";

import action from "./serverActions/action";

const ClientComponent = () => {
  const handleClick = async () => {
    console.log("Clicked");
    action();
  };
  return <button onClick={handleClick}>Click me</button>;
};

export default ClientComponent;


"use server";
import { Effect } from "effect";

const action = () => {
  return Effect.tryPromise(() => Promise.resolve("Hello World"));
};

export default action;


If you try clicking the button it will give the error. This is a minimal repro you can find the same problem when creating with create-next-app
Was this page helpful?