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

TypeError: Cannot assign to read only property 'children' of object '#<Object>' #42

Closed
atdrago opened this issue Jun 24, 2021 · 4 comments

Comments

@atdrago
Copy link

atdrago commented Jun 24, 2021

Hello! I wanted to let you know about an issue we ran into in one of our projects that was using next-boost.

Lots of details can be found here in this issue: vercel/next.js#24783 (comment)

I've created an example reproduction case here: atdrago/repro-24783@1ea71f6

The error is below, and goes away when setting NODE_ENV to production in our .env.production file, so it appears that, by default, next-boost runs with a NODE_ENV of development. This is different from next start.

The actual error we see in production is:

TypeError: Cannot assign to read only property 'children' of object '#'
at /path/to/project/.next/server/chunks/6859.js:740:29
at /path/to/project/node_modules/react/cjs/react.development.js:1067:17
at mapIntoArray (/path/to/project/node_modules/react/cjs/react.development.js:964:23)
at mapIntoArray (/path/to/project/node_modules/react/cjs/react.development.js:1004:23)
at Object.mapChildren [as map] (/path/to/project/node_modules/react/cjs/react.development.js:1066:3)
at Head.makeStylesheetInert (/path/to/project/.next/server/chunks/6859.js:732:36)
at Head.render (/path/to/project/.next/server/chunks/6859.js:789:23)
at processChild (/path/to/project/node_modules/react-dom/cjs/react-dom-server.node.development.js:3450:18)
at resolve (/path/to/project/node_modules/react-dom/cjs/react-dom-server.node.development.js:3270:5)
at ReactDOMServerRenderer.render (/path/to/project/node_modules/react-dom/cjs/react-dom-server.node.development.js:3753:22)

@rjyo
Copy link
Collaborator

rjyo commented Jun 25, 2021

Will there be errors when using getServerSideProps?

next-boost is meant to be a replacement for getStaticProps without specifying all possible routes and I have never used them together.

@atdrago
Copy link
Author

atdrago commented Jun 25, 2021

We haven't seen any errors using getServerSideProps.

It may be worth mentioning in the README if getStaticProps is not meant to be used with next-boost. Is this documented somewhere?

In my mind though, the bigger concern are the mentions of react.development.js and react-dom-server.node.development.js in the stack trace. Using it as a drop-in replacement for next start, when we don't explicitly set NODE_ENV=production, it seems next-boost runs in development mode. If we do explicitly set NODE_ENV=production in our .env file (we shouldn't need to do this), the error goes away. Any ideas why?

@rjyo
Copy link
Collaborator

rjyo commented Jun 25, 2021

Thanks for the advice. I'll take a look at the env thing.

In our setups, we have the NODE_ENV=production in every startup script and thus haven't run into this problem.

@rjyo
Copy link
Collaborator

rjyo commented Jun 25, 2021

Please check this release.

https://github.com/rjyo/next-boost/releases/tag/v0.10.2

@rjyo rjyo closed this as completed Jun 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants