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

Attempt to fix pre-render errors #137

Closed
wants to merge 1 commit into from
Closed

Conversation

gomorizsolt
Copy link
Collaborator

@gomorizsolt gomorizsolt commented May 19, 2020

I'm just guessing because the error itself is somewhat vague. Tried to follow their recommendations to find out what the root cause is but to no avail (it's an error that cannot be reproduced locally).

The issue definitely has something to do with: https://github.com/c-hive/dotdev/pull/131/files

My gut feeling is that there's something wrong with that "_app" component though it's identical to their example. Let's remove this and inject the <Head /> component in the root path (mostly because it's a single-page app without different routes with different titles).

@thisismydesign
Copy link
Member

What are pre-render errors? Do we have an issue for this?

Did you test this on your fork? Does it solve the issue?

@gomorizsolt
Copy link
Collaborator Author

gomorizsolt commented May 20, 2020

I should've been a bit more precise regarding where the issue stems from, sorry.

TL;DR

There's nothing to do with this PR. It should be fixed by #138. Let's discuss if needed.

What are pre-render errors? Do we have an issue for this?

The CI fails on master for some reason:

Error occurred prerendering page "/". Read more: https://err.sh/next.js/prerender-error

"Pre-render" is a term which is frequently used in the case of SSGs (it's one of their fundamental reasons why they're so popular). What it basically refers to is generating each page way ahead of time (pages are compiled to static HTML) which results in 1) decreased loading time (because the app can be served from the "edge", be cached etc) 2) better user-experience (there's something to look at while the page is loading). One thing that's important to note here is that even though the pages are static, they're hydrated to become a fully interactive application if needed (e.g. fetch data at client-side when a component mounts).

Resources if you're interested in this topic:

Did you test this on your fork? Does it solve the issue?

Right, it's my bad. I should've tested the changes against my forked repo instead of "guessing".

Turns out, the changes do not fix the error whatsoever:

TypeError: Cannot read property 'name' of null

import config from "../config/config.yml";

As we pointed out the other day, the CONFIG secret becomes a single-line string and because there's a leading # in the first line (because I copy-pasted the example config to the environment variable) it's converted to a single-line comment. That's the reason for receiving null when importing the config (hence the error Cannot read property 'name' of null).

@gomorizsolt
Copy link
Collaborator Author

Closed because of #137 (comment).

@gomorizsolt gomorizsolt deleted the fix-prerender-error branch May 21, 2020 10:00
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

Successfully merging this pull request may close these issues.

None yet

2 participants