Skip to content

Error: Cannot access .prototype on the server when rendering a dotted client component without a key #52415

@tom-sherman

Description

@tom-sherman

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.13.0
      npm: 8.13.2
      Yarn: 1.22.19
      pnpm: 8.6.6
    Relevant Packages:
      next: 13.4.10-canary.0
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 4.9.4
    Next.js Config:
      output: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

App Router

Link to the code that reproduces this issue or a replay of the bug

https://github.com/tom-sherman/nextjs-key-prototype-bug

To Reproduce

  1. import * a "use client" module
  2. Render an exported component from that module without a key in a server component eg. <Client.Component> in an array without a key
  3. next dev

Describe the Bug

Receive an error on first load after starting the dev server

 error node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/build/webpack/loaders/next-flight-loader/module-proxy.js (51:14) @ Object.get
- error Error: Cannot access .prototype on the server. You cannot dot into a client module from a server component. You can only pass the imported name through.
    at Component (./app/component.tsx:11:87)
    at stringify (<anonymous>)

This error goes away after refresh

Expected Behavior

The component should render without errors and I should receive a missing key warning.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-1452

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions