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

[NEXT-1231] This is probably a bug in the React Server Components bundler. #50243

Closed
1 task done
codeawy opened this issue May 24, 2023 · 36 comments · Fixed by #52795
Closed
1 task done

[NEXT-1231] This is probably a bug in the React Server Components bundler. #50243

codeawy opened this issue May 24, 2023 · 36 comments · Fixed by #52795
Assignees
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team.

Comments

@codeawy
Copy link

codeawy commented May 24, 2023

Verify canary release

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

Provide environment information

Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Pro
    Binaries:
      Node: 18.16.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.4.3
      eslint-config-next: 13.4.3
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.0.4

warn  - Latest canary version not detected, detected: "13.4.3", newest: "13.4.4-canary.6".
        Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
        Read more - https://nextjs.org/docs/messages/opening-an-issue

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

No response

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

npx create-next-app --example reproduction-template-app-dir reproduction-app

To Reproduce

When attempting to generate a new Next.js project using the command npx create-next-app@latest, I encountered an error in app-router.js# related to the React Client Manifest. This error is likely due to a bug in the React Server Components bundler, which was triggered after running the npm run dev command.

image

Describe the Bug

image

Expected Behavior

Generate a new Next.js app with the latest features

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-1231

@codeawy codeawy added the bug Issue was opened via the bug report template. label May 24, 2023
@shuding shuding added the linear: next Confirmed issue that is tracked by the Next.js team. label May 24, 2023
@shuding shuding changed the title This is probably a bug in the React Server Components bundler. [NEXT-1231] This is probably a bug in the React Server Components bundler. May 24, 2023
@hiramhuang
Copy link
Contributor

Same issue here. I'm running on next@13.4.2, and this error only occur on production build.

@codeawy
Copy link
Author

codeawy commented May 25, 2023

I tried to generate a new project now, and this working fine ❤️

@codeawy codeawy closed this as completed May 25, 2023
@leimonio
Copy link

leimonio commented Jun 9, 2023

I'm facing a similar issue running NextJS application through a custom http server, using the next module v13.4.4
The module itself exists in the given path, but there is also a hash appended.

Uncaught Error: Could not find the module "{absolutePathToFolder}/bit-next-app-type/node_modules/.pnpm/next@13.4.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/image.js#" in the React Client Manifest. This is probably a bug in the React Server Components bundler.
    at resolveClientReferenceMetadata (webpack-internal:///(sc_server)/../../../../../.pnpm/next@13.4.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js:205:27)

@leimonio
Copy link

leimonio commented Jun 9, 2023

@shuding After a bit further debugging of this it seems like webpackMap here only includes references from inside components folder but nothing related to the client/image.js. Is this an expected behavior?

https://github.com/vercel/next.js/blob/2226d2935f04e10de0a5d563067e7d32e6872f00/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js#LL2948C10-L2948C32

@Abhishek-Selfridges
Copy link

I am still getting the same error when trying to execute npm run dev . I am trying to create a new next js project using npx create-next-app . I tried with both the @latest and without latest and for both it gives same error in sonsole as **Could not find the module app-router.js in the React Client Manifest. This is probably a bug in the React Server Components bundler. **

@shuding @codeawy

@leimonio
Copy link

@Abhishek-Selfridges can you please raise a new issue? my setup is a bit more complicated to share at the moment, so I think the team would really appreciate it if they have more detailed information about how to reproduce this issue.

@simrin3308
Copy link

Faced the same error today. Any fix?

@shawnesquivel
Copy link

Any fix for this? Finding that some people can run npm install on my project, but when they run npm run dev they get this error.

@desca96aws
Copy link

image

I get the same issue in the browser, this is what I get in the terminal

@gharis94
Copy link

gharis94 commented Jul 3, 2023

I am having the same issue, did anyone resolve it? if yes then please share.

@darasus
Copy link

darasus commented Jul 3, 2023

I'm getting similar issue only when running route on edge.

Error: Could not find the module "/vercel/path0/apps/web/src/components/Marketing/GetStartedButton.tsx#GetStartedButton" in the React Client Manifest. This is probably a bug in the React Server Components bundler.
    at (../../node_modules/.pnpm/next@13.4.8-canary.14_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.min.js:35:327)
    at (../../node_modules/.pnpm/next@13.4.8-canary.14_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.min.js:40:79)
    at (../../node_modules/.pnpm/next@13.4.8-canary.14_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.min.js:29:150)
    at (../../node_modules/.pnpm/next@13.4.8-canary.14_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.min.js:50:197)
    at (../../node_modules/.pnpm/next@13.4.8-canary.14_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.min.js:45:449)
    at (../../node_modules/.pnpm/next@13.4.8-canary.14_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.min.js:33:406)

@stevedeighton
Copy link

stevedeighton commented Jul 3, 2023

I'm seeing this error when using the Image component. I'm on next@13.4.8 which was released just a few hours ago. Everything is working as expected until I use the Image component. I get this error...

Error: Could not find the module "MY_PROJECT_PATH/node_modules/next/dist/client/image-component.js#Image" in the React Client Manifest. This is probably a bug in the React Server Components bundler.

I also see this in the terminal...

error node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js (188:12) @ resolveClientReferenceMetadata.

Maybe this issue can be reopened please?

@alexkirsz alexkirsz reopened this Jul 8, 2023
@eliasbauer1
Copy link

Solved the problem

Solve: I added "use client" in the parent component.
Explanation: I rendered the child component dynamically, so if I tried to use useEffect on the child component, it didn't work. For it to not get rendered on the server (and throw the error) I added "use client".

@alexkirsz
Copy link
Contributor

I think this is about as small a repro as I can make it. The issue seems to stem from using a dynamic import. I've personally encountered this while loading MDX components, but this can occur with any kind of component.

Repro: https://github.com/alexkirsz/next-app-router-dynamic-issue

@stevedeighton
Copy link

alexkirsz/next-app-router-dynamic-issue

Yes good call. My project is using dynamic imports too!

@stevedeighton
Copy link

@alexkirsz Looks like this issue isn't isolated to the Image component, as I'm getting the same error when using the link component in a component that's dynamically imported.

Error: Could not find the module "/MY_PROJECT_PATH/node_modules/next/dist/client/link.js#" in the React Client Manifest. This is probably a bug in the React Server Components bundler.

@gokulkrishh
Copy link

gokulkrishh commented Jul 12, 2023

@stevedeighton I am having similar issue but for different file. Still trying to figure out what it it.

Error: Could not find the module "/vercel/path0/node_modules/next/dist/client/components/error-boundary.js#" in the React Client Manifest. This is probably a bug in the React Server Components bundler.
    at gb (/var/task/.next/server/chunks/2578.js:7033:27)
    at Ya (/var/task/.next/server/chunks/2578.js:7107:38)
    at Object.toJSON (/var/task/.next/server/chunks/2578.js:6871:20)
    at stringify (<anonymous>)
    at ib (/var/task/.next/server/chunks/2578.js:7278:9)
    at fb (/var/task/.next/server/chunks/2578.js:7177:29)
    at Timeout._onTimeout (/var/task/.next/server/chunks/2578.js:7002:16)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)
[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
  digest: '1623416432'
}

@gokulkrishh
Copy link

Found out that error.tsx file for error handling was missing. Even though there was no error in development but got the above issue in production.

@ctkc
Copy link
Contributor

ctkc commented Jul 12, 2023

@gokulkrishh I had the same error. In my case I was implementing global-error.tsx and I was getting this issue during the productive build, I removed it and it's working properly now

@gokulkrishh
Copy link

@ctkc Yes looks like it, global-error.tsx file caused this issue. Resolved it by removing it. Thanks.

@stevedeighton
Copy link

I have also spotted this error using useState. It appears anything that's client side isn't working with dynamic imports, unless I'm doing something totally wrong. I have tried adding use client to all of my components but it's still not playing nice. I'll be reverting to the pages router for now :(

@louisthomaspro
Copy link

louisthomaspro commented Jul 15, 2023

This error is so weird.. I had it for a moment. I switched branch, then came back to the my main branch. And the error disappeared.
My error log was:

Error: Could not find the module "/home/git/project/components/side-sheet-wrapper.tsx#SideSheetWrapper" in the React Client Manifest. This is probably a bug in the React Server Components bundler.

@keno-reloaded
Copy link

Getting the following error:

Error: Could not find the module "/Users/[user]/Projects/ProjectName/components/Modal.tsx#" in the React Client Manifest. This is probably a bug in the React Server Components bundler.

NextJs version:
"next": "^13.4.10",

Node version:
v18.16.0

I'm using the Intercepting Routes feature.

It was working yesterday, I updated NextJs today, and it is not working anymore.

  • app
    • layout.tsx (modal is added in the layout)
    • page.tsx
    • project/[id]
      • page.tsx
    • @modal
      • (.)project/[id]
        • page.tsx

Things I've tried so far without success:

  • Delete .next folder
  • Delete node_modules folder
  • Delete package-lock.json
  • npm cache clean --force
  • npm install

@askinbilir
Copy link

Getting the following error:

Error: Could not find the module "/Users/[user]/Projects/ProjectName/components/Modal.tsx#" in the React Client Manifest. This is probably a bug in the React Server Components bundler.

NextJs version: "next": "^13.4.10",

Node version: v18.16.0

I'm using the Intercepting Routes feature.

It was working yesterday, I updated NextJs today, and it is not working anymore.

  • app

    • layout.tsx (modal is added in the layout)

    • page.tsx

    • project/[id]

      • page.tsx
    • @modal

      • (.)project/[id]

        • page.tsx

Things I've tried so far without success:

  • Delete .next folder
  • Delete node_modules folder
  • Delete package-lock.json
  • npm cache clean --force
  • npm install

I faced with same issue, I don't know the problem, but I guess client components cause the crash when I remove them it's working so if you convert all components to server components, probably will work.

@IamSolaSholzy01
Copy link

Getting the following error:

Error: Could not find the module "/Users/[user]/Projects/ProjectName/components/Modal.tsx#" in the React Client Manifest. This is probably a bug in the React Server Components bundler.

NextJs version: "next": "^13.4.10",

Node version: v18.16.0

I'm using the Intercepting Routes feature.

It was working yesterday, I updated NextJs today, and it is not working anymore.

  • app

    • layout.tsx (modal is added in the layout)

    • page.tsx

    • project/[id]

      • page.tsx
    • @modal

      • (.)project/[id]

        • page.tsx

Things I've tried so far without success:

  • Delete .next folder
  • Delete node_modules folder
  • Delete package-lock.json
  • npm cache clean --force
  • npm install

I'm now facing the same issue after upgrading from Next 13.4.7 to 13.4.10.
V13.4.8 had a different issue, that caused a client exception.

@monzim
Copy link

monzim commented Jul 16, 2023

Same issue
NextJs version: "next": "13.4.10",
React: "react": "18.2.0",

`@modal

(.)project/[id]

page.tsx`

@piedrahitapablo
Copy link

Getting the following error:

Error: Could not find the module "/Users/[user]/Projects/ProjectName/components/Modal.tsx#" in the React Client Manifest. This is probably a bug in the React Server Components bundler.

NextJs version: "next": "^13.4.10",

Node version: v18.16.0

I'm using the Intercepting Routes feature.

It was working yesterday, I updated NextJs today, and it is not working anymore.

  • app

    • layout.tsx (modal is added in the layout)

    • page.tsx

    • project/[id]

      • page.tsx
    • @modal

      • (.)project/[id]

        • page.tsx

Things I've tried so far without success:

  • Delete .next folder
  • Delete node_modules folder
  • Delete package-lock.json
  • npm cache clean --force
  • npm install

I was facing the same issue, downgrading to 13.4.7 fixed the problem. The nextgram example is using that version.

@acomanescu
Copy link

Same issue when upgrading from 13.4.9 to 13.4.10.

@shuding shuding self-assigned this Jul 17, 2023
@piedrahitapablo
Copy link

I think this is related to #52681

@kodiakhq kodiakhq bot closed this as completed in #52795 Jul 17, 2023
kodiakhq bot pushed a commit that referenced this issue Jul 17, 2023
When doing dynamic imports like `import(variable)`, Webpack _tries_ to statically analyze it and creates a regex like context module for it (which includes all possible modules). This `ContextModule` doesn't have a resource path so we need to use the identifier to track it.

Tested with @alexkirsz's repro here #50243 (comment) and confirmed that it fixes the problem.

Closes #50243.
@pawanrana1992
Copy link

Guys please remove global-error.tsx it is the culprit here. I tried many things but this issue with error handling from nextjs side. Nextjs team should look into it on priority.
version: "next": "13.4.10", (app-directory)

@timneutkens
Copy link
Member

@pawanrana1992 can you share a reproduction of your application where it fails in a new issue? Might be something in the file? I.e. maybe not rendering <html> etc.?

@timneutkens
Copy link
Member

Please open a new issue as I requested.

@julioflima
Copy link

@khuezy
Copy link
Contributor

khuezy commented Jul 19, 2023

@dihan48 Are you going to create the new issue, or should I?

@timneutkens
Copy link
Member

I'm going to lock this issue, please read my earlier comments.

@vercel vercel locked and limited conversation to collaborators Jul 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.