-
Notifications
You must be signed in to change notification settings - Fork 30k
Closed
Bug
Copy link
Labels
Description
Link to the code that reproduces this issue
To Reproduce
- start the dev server (bun dev or npm run dev)
- open localhost:3000
- click on submit button
Current vs. Expected behavior
current behavior:
It thows a ReferenceError: someValueFromRender is not defined

expected behavior
server action can access and log the value "someValueFromRender"
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.4.0: Tue Mar 4 21:05:34 PST 2025; root:xnu-11417.100.576.505.3~2/RELEASE_ARM64_T6000
Available memory (MB): 32768
Available CPU cores: 10
Binaries:
Node: 20.16.0
npm: 10.5.0
Yarn: 1.22.19
pnpm: N/A
Relevant Packages:
next: 15.2.3 // Latest available version is detected (15.2.3).
eslint-config-next: N/A
react: 19.0.0
react-dom: 19.0.0
typescript: 5.8.2
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Server Actions
Which stage(s) are affected? (Select all that apply)
next dev (local), next start (local)
Additional context
I tested it aganist the following next versions:
- 15.2.3 (failed)
- 15.1.7 (failed)
- 15.0.4 (PASSED)
- 14.x (PASSED)
I tested it with and without turbo flag
When bun dev fails, npm run dev fails too.
It works when I move all lambda and/or function declarations out of the "use server" function
export default function Home() {
const someValueFromRender = "someValueFromRender";
return (
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<form
action={async function submit() {
"use server";
console.log(someValueFromRender);
// it works now
doSomething();
}}
>
<button type="submit">Submit</button>
</form>
</div>
);
}
function doSomething() {
[1, 2, 3].map((x) => x + 1);
}ttlong3103