-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Error: Cannot access .prototype on the server
when rendering a dotted client component without a key
#52415
Comments
Error: Cannot access .prototype on the server
when rendering a dotted client component without a key
This also happened to me when doing a |
Did some digging and found why this happens, it's specifically related to the way I'll ask @acdlite to have a look, seems like a bug in React 👍 |
any fix for this issue ? and is it only there for development mode ?? |
The error goes away if you ensure that you are assigning unique keys to array child elements, as is required by React. I believe this issue is more about making sure the correct error message is shown to the user. |
I have provided unique keys too but still getting this issue |
Can you share a minimal reproduction? |
yes sure https://github.com/kunwar-11/ecommerce-nextjs To Reproduce fork the repository and install all dependency by npm install start the application by npm run dev visit http://localhost:3000/Football after running via npm run dev you will see the error :- error node_modules/next/dist/build/webpack/loaders/next-flight-loader/module-proxy.js (51:14) @ Object.get
I have sent .env to your twitter this is issue is coming for fraction of second an then goes away |
i have sent the env to your twitter |
Any further updates on this issue? I also encountered this error on v15.0.1 and it returned to normal after rolling back to v13.4.19. I used "@next/mdx" and defined some components in "mdx-components.tsx" and the error message is pointing to these components. |
+1, I'm using shadcn/ui. |
I'm encountering this as well, using shadcn/ui in NextJS 13.5.5. Specifically:
|
My error was related to the reactReplaceString library. Adding to the Image key fixed the problem
|
still on 13.5.5 Error goes:
For me, this happens on every un-keyed and arrayed client components. import { Button } from "@mantine/core";
export default async function Page() {
return (
<>
<Button /> ✅
{[<Button />]} ❌
{[<Button key="123" />]} ✅
</>
);
} I think we should make this error message more clear. |
Giving a |
@sreuter This is worked for me. |
Needed a key on the tiles being mapped. See: vercel/next.js#52415 (comment)
Tested against the latest canary (14.0.5-canary.45) the issue is resolved for me now |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify 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
import *
a "use client" module<Client.Component>
in an array without a keynext dev
Describe the Bug
Receive an error on first load after starting the dev server
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
The text was updated successfully, but these errors were encountered: