Skip to content

[Server Actions] Calling server actions causes TypeError: Cannot redefine property: $$id to throw #61183

@mwskwong

Description

@mwskwong

Link to the code that reproduces this issue

https://github.com/mwskwong/server-actions-build-fail

To Reproduce

  1. Call any server actions in a v14.1.1-canary.10 or above Next.js app

Current vs. Expected behavior

Current:
The following error is thrown when an arbitrary server action is called.

TypeError: Cannot redefine property: $$id
    at Function.defineProperties (<anonymous>)
    at t.registerServerReference (/server-actions-build-fail/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:141808)
    at i (/server-actions-build-fail/.next/server/app/page.js:1:18906)
    at 4426 (/server-actions-build-fail/.next/server/app/page.js:1:16042)
    at t (/server-actions-build-fail/.next/server/webpack-runtime.js:1:127)
    at 801 (/server-actions-build-fail/.next/server/app/page.js:1:16510)
    at Function.t (/server-actions-build-fail/.next/server/webpack-runtime.js:1:127)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async collectGenerateParams (/server-actions-build-fail/node_modules/next/dist/build/utils.js:920:21)
    at async /server-actions-build-fail/node_modules/next/dist/build/utils.js:1143:17

Expected: No error prompted

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000
Binaries:
  Node: 20.10.0
  npm: 10.2.3
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 14.1.1-canary.12 // Latest available version is detected (14.1.1-canary.12).
  eslint-config-next: 14.1.1-canary.12
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.3
Next.js Config:
  output: N/A

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

App Router

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

next build (local), next start (local)

Additional context

  • This issue starts appearing in v14.1.1-canary.10
  • Although the reproduction calls the server action directly in an RSC and causes the project to fail to build, the issue is also observed when calling a server action upon user interactions (e.g. on button click), except it will be a runtime error instead.
  • Potentially related to Error: Cannot redefine property: $$id in action-proxy.ts #54655

Metadata

Metadata

Assignees

Labels

bugIssue was opened via the bug report template.locked

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions