You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Server Actions must be async functions." error will shows up, but incorrectly.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103
Available memory (MB): 16384
Available CPU cores: 8
Binaries:
Node: 20.12.0
npm: 10.5.0
Yarn: 1.22.21
pnpm: 8.15.7
Relevant Packages:
next: 15.0.3-canary.6 // Latest available version is detected (15.0.3-canary.6).
eslint-config-next: N/A
react: 19.0.0-rc-7c8e5e7a-20241101
react-dom: 19.0.0-rc-7c8e5e7a-20241101
typescript: 5.3.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local)
Additional context
I'm an author of a small library called server-act, which the library is a simple server action builder by using the function builder pattern to construct a server action, like
constaction=builder.input(...).action(...);
However, since Next.js 15, Next.js failed to detect the async function/server action correctly. For instance:
exportconstaction=builder.input(()=>{ ... })// <-- Next.js keeps saying that this needs to be an async function, message: "Server Actions must be async functions.".action(...);// <-- this will always return an async function, aka server action
Link to the code that reproduces this issue
https://github.com/chungweileong94/nextjs-server-action-async-func-bug
To Reproduce
pnpm dev
Current vs. Expected behavior
Expected:
Current
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 Available memory (MB): 16384 Available CPU cores: 8 Binaries: Node: 20.12.0 npm: 10.5.0 Yarn: 1.22.21 pnpm: 8.15.7 Relevant Packages: next: 15.0.3-canary.6 // Latest available version is detected (15.0.3-canary.6). eslint-config-next: N/A react: 19.0.0-rc-7c8e5e7a-20241101 react-dom: 19.0.0-rc-7c8e5e7a-20241101 typescript: 5.3.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local)
Additional context
I'm an author of a small library called server-act, which the library is a simple server action builder by using the function builder pattern to construct a server action, like
However, since Next.js 15, Next.js failed to detect the async function/server action correctly. For instance:
The same thing happens to one of the similar library as well, TheEdoRan/next-safe-action#288.
The text was updated successfully, but these errors were encountered: