Skip to content
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

Functions inside server action cause parent function variable out of scope to acceces #74961

Open
bill-zhanxg opened this issue Jan 16, 2025 · 0 comments

Comments

@bill-zhanxg
Copy link

bill-zhanxg commented Jan 16, 2025

Link to the code that reproduces this issue

https://codesandbox.io/p/live/d4f89afd-d802-4e4b-b56c-db9c06d877ff

To Reproduce

  1. Start the dev server from the codesandbox link
  2. click the button

Current vs. Expected behavior

It throws an error on the server because it cannot access the variable id

expected: log out the id without error

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 15.2.0-canary.12 // Latest available version is detected (15.2.0-canary.12).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.3.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Server Action

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

@bill-zhanxg bill-zhanxg added the bug Issue was opened via the bug report template. label Jan 16, 2025
@samcx samcx removed the bug Issue was opened via the bug report template. label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants