facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
229.3k stars 46.96k forks source link

Bug: Not enough information in stack trace #21920

Closed Nefcanto closed 3 years ago

Nefcanto commented 3 years ago

When I want to build my website, I see this error:

info  - Generating static pages (3/5)

Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Minified React error #143; visit https://reactjs.org/docs/error-decoder.html?invariant=143 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at Object.only (/Company/Site/node_modules/react/cjs/react.production.min.js:19:241)
    at Link (/Company/Site/.next/server/chunks/61.js:685:29)
    at d (/Company/Site/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:33:498)
    at bb (/Company/Site/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:16)
    at a.b.render (/Company/Site/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:42:43)
    at a.b.read (/Company/Site/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:41:83)
    at exports.renderToString (/Company/Site/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:52:138)
    at Object.renderPage (/Company/Site/node_modules/next/dist/next-server/server/render.js:53:854)
    at Function.getInitialProps (/Company/Site/.next/server/pages/_document.js:508:19)
    at loadGetInitialProps (/Company/Site/node_modules/next/dist/next-server/lib/utils.js:5:101)

This has no reference to my code. I can't understand what the problem is.

A typical website can have pages that can have at least 500 lines of code. This stack trace does nothing in troubleshooting the error.

And when I go to the URL you have provided, all I see is this:

React.Children.only expected to receive a single React element child.

It's a little help. But where should I find this? What file? What line? Of course it's not possible to scan an entire 10K codebase to guess what the problem might be.

React version: 17.0.2

Steps To Reproduce

I don't know.

Please don't close this issue. I have a complete website and I don't know what should be done to recreate the issue.

The current behavior

Next Build engine does not give us information about our code. This makes debugging extremely hard if not impossible.

The expected behavior

Tell us what file and what line has the problem.

bvaughn commented 3 years ago

Next Build engine does not give us information about our code. This makes debugging extremely hard if not impossible.

If you're seeing a build error from Next, you'll need to search their documentation (or perhaps reach out to their support for help).

It looks like you already opened an issue with Next: https://github.com/vercel/next.js/issues/27330

Nefcanto commented 3 years ago

Yeah @bvaughn , I posted my issue here by mistake. But to my surprise, it didn't have a delete button :). Thank you.

bvaughn commented 3 years ago

No problem. Good luck!