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

fix(gatsby): add sanity check before displaying path for static html build error #11620

Merged
merged 1 commit into from
Feb 7, 2019

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Feb 7, 2019

We currently swallow errors and display Cannot read property 'path' of undefined if error wasn't decorating with context[.path]. This can happen if error is thrown just when requiring render-page module (in

const htmlComponentRenderer = require(htmlComponentRendererPath)
)

It doesn't make sense to add path for page for those errors because it's not page specific and would throw for all pages, so instead let's add sanity check before trying to output path for page.

The bug can be reproduced by cloning https://github.com/dfds-frontend/gatsby-dfds-starter/tree/5f2568ebe3c79bfbc093a3d1fd7d78ae6da8f93e and commenting out en var sanity check in gatsby-config.js

@pieh pieh requested a review from a team as a code owner February 7, 2019 12:31
Copy link
Contributor

@DSchau DSchau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pieh pieh merged commit 3ee60d5 into gatsbyjs:master Feb 7, 2019
@pieh pieh deleted the static-html-error-sanity-check branch February 7, 2019 12:41
@KyleAMathews
Copy link
Contributor

Nice!

@pieh pieh restored the static-html-error-sanity-check branch May 17, 2020 21:28
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

4 participants