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

False positive for the "Server Actions must be async functions." diagnostic when using builder pattern with arrow function #77864

Open
ChristianIvicevic opened this issue Apr 5, 2025 · 0 comments
Labels
linear: turbopack Confirmed issue that is tracked by the Turbopack team. Server Actions Related to Server Actions. Turbopack Related to Turbopack with Next.js.

Comments

@ChristianIvicevic
Copy link
Contributor

Link to the code that reproduces this issue

https://github.com/ChristianIvicevic/debug/tree/turbopack-async-arrow-function

To Reproduce

  1. pnpm install
  2. pnpm dev
  3. Attempt to open the root page and see the false positive

Current vs. Expected behavior

Current behavior

Image

Extracting that inlined schema into a separate object does work and won't trigger the false positive.

Expected behavior

Being able to inline the schema here which is the cause of the false positive:

export const $serverAction = actionClient
	.schema(
		z.object({
			things: z.enum(Object.entries(things).map(([kind]) => kind) as [string, ...string[]]),
		}),
	)
	.action(async () => {})

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:23 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6031
  Available memory (MB): 49152
  Available CPU cores: 16
Binaries:
  Node: 22.14.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 10.7.1
Relevant Packages:
  next: 15.2.4 // Latest available version is detected (15.2.4).
  eslint-config-next: N/A
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.8.3
Next.js Config:
  output: N/A

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

Turbopack, Server Actions

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

next dev (local)

Additional context

No response

@github-actions github-actions bot added Server Actions Related to Server Actions. Turbopack Related to Turbopack with Next.js. labels Apr 5, 2025
@mischnic mischnic added the linear: turbopack Confirmed issue that is tracked by the Turbopack team. label Apr 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear: turbopack Confirmed issue that is tracked by the Turbopack team. Server Actions Related to Server Actions. Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

2 participants