Closed littlechad closed 3 months ago
Seems to be a duplicate of #70. The action client should be placed in a different file (like lib/safe-action.ts
) without the "use server"
directive, as explained in the docs. "use server"
is just needed for files where you declare Server Actions. If this doesn't solve the problem, please provide a link to a repo with a minimal reproduction of the issue, thanks.
Ah, you're right, after placing the client on a different file it works, thanks!
Are you using the latest version of this library?
Is there an existing issue for this?
Describe the bug
Got
Error: A "use server" file can only export async functions, found object.
when submitting using theexecute
method. And i can confirm that the same code is working on v6Reproduction steps
Expected behavior
Form got sumbitted and data got inserted to the db
Minimal reproduction example
-
Operating System
node:lts-alpine
Library version
^7.4.3
Next.js version
14
Additional context
No response