-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ASK] How do I avoid FetchError: "TypeError: Cannot redefine property: $$id" #56
Comments
The more I try and investigate this I think it has something to do with how actions are being compiled by turbopack. Specifically this function in my function createActionProxy(id, action) {
return (0, _serveredge.registerServerReference)(action, id, null);
} //# sourceMappingURL=action-proxy.js.map EDIT: Get the same error without |
Well, that's pretty unusual. I don't use Drizzle but it should not happen, never happened to me using Prisma/Kysely. Can you please provide a minimal reproduction example in a repo, so I can investigate this issue? Thank you. |
Annoyingly, so far I have been unable to recreate the issue in a new repo. As I add complexity, I'll let you know if it crops up again. |
I can't believe what seems to have actually caused this issue!! Works fine import GroupList from "@/components/group-list";
import { db } from "@/server/db";
import groupsTable from "@/server/db/schema";
export async function HomePage() {
const groups = await db.select().from(groupsTable);
return (
<main className="container mx-auto">
<div className="flex flex-col gap-4">
<h1>Home</h1>
<GroupList groups={groups} />
</div>
</main>
);
}
export default HomePage; Also works fine "use server";
import GroupList from "@/components/group-list";
import { db } from "@/server/db";
import groupsTable from "@/server/db/schema";
export default async function HomePage() {
const groups = await db.select().from(groupsTable);
return (
<main className="container mx-auto">
<div className="flex flex-col gap-4">
<h1>Home</h1>
<GroupList groups={groups} />
</div>
</main>
);
} BUT - using "use server" AND having the default export declared at the end, causes the error. This code causes the error: "use server";
import GroupList from "@/components/group-list";
import { db } from "@/server/db";
import groupsTable from "@/server/db/schema";
export async function HomePage() {
const groups = await db.select().from(groupsTable);
return (
<main className="container mx-auto">
<div className="flex flex-col gap-4">
<h1>Home</h1>
<GroupList groups={groups} />
</div>
</main>
);
}
export default HomePage; |
Thank you for your tests! So this is a Next.js issue, right? Can we close this one and track this PR? |
Agree this is likely an issue for Next.js to fix in vercel/next.js#54655 Useful one to be aware of though! Whod have thought exporting named and default would cause such issues? EDIT: Looks like a fix already merged into canary: vercel/next.js#61244 |
Every day we find something new in this amazing Server Actions world! 😅 Thank you again for your work, I'll close this issue since it's a framework related one, and probably fixed in the next release. |
Is there an existing issue for this?
Library version (optional)
6.0.2
Ask a question
I assume I have made a silly error, but I keep getting a "Fetch Error" when running execute from useAction hook.
Everything works fine if I run the db query
insertGroup(values)
instead ofexecute
, but the minute I try and use useAction I get"TypeError: Cannot redefine property: $$id"
I'm following developedbyed s tutorial, if that helps: https://www.youtube.com/watch?v=UKupfEuUc1M&t=71s
Additional context
No response
The text was updated successfully, but these errors were encountered: