question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error while running `getDataFromTree` ReferenceError: document is not defined

See original GitHub issue
Error while running `getDataFromTree` ReferenceError: document is not defined
    at /frontend/client/node_modules/tss-react/next.js:108:45
    at /frontend/client/node_modules/tss-react/next.js:111:23
    at AppWithEmotionCache (/frontend/client/node_modules/tss-react/next.js:116:110)
    at processChild (/frontend/node_modules/react-dom/cjs/react-dom-server.node.development.js:3353:14)
    at resolve (/frontend/node_modules/react-dom/cjs/react-dom-server.node.development.js:3270:5)
    at ReactDOMServerRenderer.render (/frontend/node_modules/react-dom/cjs/react-dom-server.node.development.js:3753:22)
    at ReactDOMServerRenderer.read (/frontend/node_modules/react-dom/cjs/react-dom-server.node.development.js:3690:29)
    at renderToStaticMarkup (/frontend/node_modules/react-dom/cjs/react-dom-server.node.development.js:4314:27)
    at /frontend/client/node_modules/@apollo/client/react/ssr/ssr.cjs.js:105:21
    at new Promise (<anonymous>)

Versions

{
    "tss-react": "^4.3.4",
    "next": "12.3.1",
    "@emotion/cache": "^11.10.3",
    "@emotion/react": "^11.10.4",
    "@emotion/server": "^11.10.0",
    "@emotion/styled": "^11.10.4",
    "@mui/icons-material": "^5.10.9",
    "@mui/lab": "^5.0.0-alpha.103",
    "@mui/material": "^5.10.9",
    "@mui/styles": "^5.10.9",
    "@mui/system": "^5.10.9",
}
image image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
garronejcommented, Oct 14, 2022

Sorry, it’s a runtime error, my bad.
I’ll fix this tonight, I’ll let you know when it’s done.

0reactions
ianberdincommented, Oct 17, 2022

Hi @garronej. Thank you for the quick fix! It perfectly work.

Also we had to downgrade from react 18 to 17. Because Apollo SSR doesn’t ready yet.

Would you tell me with what MUI component in particular? - there is no a specific component. There are a lot broken things.

Thanks again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fixing Next js "ReferenceError: document is not defined"
The error is thrown because document is only available inside the browser and not on the server. Next js executes this code on...
Read more >
Network error: document is not defined when accessing page ...
When I try to load a page that requires authentication without being authenticated I get the following document is not defined error in...
Read more >
How To Fix ReferenceError document is not defined ... - Isotropic
If you are trying to use the document object and receiving a ReferenceError: document is not defined error then there is a good...
Read more >
How to solve the document is not defined error - Flavio Copes
Here's how to fix the “referenceerror: document is not defined” error ... In Next.js you can fix this problem by wrapping the code...
Read more >
ReferenceError: document is not defined (in plain JavaScript)
When you are using server side rendering there is no browser. Hence, there will not be any variable window or document . Hence...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found