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

Make missing Document components trigger an error for production builds #32338

Closed
oriolcp opened this issue Dec 9, 2021 · 1 comment · Fixed by #32345
Closed

Make missing Document components trigger an error for production builds #32338

oriolcp opened this issue Dec 9, 2021 · 1 comment · Fixed by #32345
Labels
template: bug A user has filled out the bug report template. Issue needs triaging

Comments

@oriolcp
Copy link
Contributor

oriolcp commented Dec 9, 2021

What version of Next.js are you using?

12.05 and above

What version of Node.js are you using?

14.17.6

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

Other platform

Describe the Bug

When the user is a bot we only want to serve a plain version of the page without any javascript, but since version 12.05 if we do not include NextScript it triggers a 500 Server error.

Expected Behavior

If we do not include NextScript it should render a version without javascripts, since this PR was merged we can not do it anymore. As far as I knew, requiring NextScripts for dev environments made total sense because it could not work without javascript in the client side, but in production we have cases where we do not want to send any javascript to the user and the page should be a plain html.
In the mentioned PR, the production check was removed.

To Reproduce

  • Remove NextScript from a custom _document.js
  • Requesting any page will trigger a 500 error NextScript must be present.
@oriolcp oriolcp added the template: bug A user has filled out the bug report template. Issue needs triaging label Dec 9, 2021
ijjk added a commit that referenced this issue Dec 13, 2021
…ion builds (#32345)

* Only validate _document subcomponents in dev environment

* Replace error by a warning

Co-authored-by: JJ Kasper <jj@jjsweb.site>
cdierkens pushed a commit to cdierkens/next.js that referenced this issue Dec 20, 2021
…roduction builds (vercel#32345)

* Only validate _document subcomponents in dev environment

* Replace error by a warning

Co-authored-by: JJ Kasper <jj@jjsweb.site>
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
natew pushed a commit to natew/next.js that referenced this issue Feb 16, 2022
…roduction builds (vercel#32345)

* Only validate _document subcomponents in dev environment

* Replace error by a warning

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
template: bug A user has filled out the bug report template. Issue needs triaging
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants