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

docs: guide on troubleshooting common errors #19966

Merged
merged 11 commits into from
Dec 12, 2019
Merged

Conversation

gillkyle
Copy link
Contributor

@gillkyle gillkyle commented Dec 6, 2019

Description

This PR adds a reference guide to the section in the docs on "Debugging Gatsby".

I did a lot of Googling and used a search on GitHub to get the most 👍 (+1'd) comments in the Gatsby repo in DESC order. From there I tried to identify errors that people seemed to hit frequently that weren't real bugs (ie errors in Gatsby that need to be fixed) or things not supported yet (like adding variables to static queries).

I came up with a pretty short list and figured I could open up this PR to see if anyone else had suggestions and/or references for other commonly encountered errors. These are what are covered:

  • common cache errors and clearing the cache with gatsby clean
  • inconsistent styles between dev and build
  • the notorious Field "image" must not have a selection since type "String" has no subfields
  • sharp installation issues
  • build errors from different environments not finding filepaths with differing capitalization
  • build errors trying to access window

In my opinion, this guide shouldn't be an alternative to stackoverflow or the issues tab. I think it does open up discussion about additional ways Gatsby can help guide users through these problems (one I thought of was would a potential gatsby-plugin-image library package up gatsby-plugin-sharp gatsby-transformer-sharp so that people don't include them in the wrong order and ease that installation and configuration process?).

Documentation

There are some existing mentions of errors described and outlined in what I wrote up elsewhere in the docs and in plugin READMEs. I think an advantage of this doc is centralizing some common gotchas from those peripheral locations but providing links out to the guides that might have even more context.

Related Issues

Related to #19196

@gillkyle gillkyle added the type: documentation An issue or pull request for improving or updating Gatsby's documentation label Dec 6, 2019
@gillkyle gillkyle requested review from a team as code owners December 6, 2019 00:56
Copy link
Contributor

@laurieontech laurieontech left a comment

Choose a reason for hiding this comment

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

This is awesome @gillkyle! Added some minor comments and edits.

Off the top of my head I'm thinking of some GraphQL query errors that we may want to add. They're mostly related to not having the file system plugin set up for the right directory in your project so Gatsby can't see the files you're trying to query. I'll track down the actual phrasing and add that here.

docs/docs/troubleshooting-common-errors.md Outdated Show resolved Hide resolved
docs/docs/troubleshooting-common-errors.md Show resolved Hide resolved
docs/docs/troubleshooting-common-errors.md Outdated Show resolved Hide resolved
docs/docs/troubleshooting-common-errors.md Outdated Show resolved Hide resolved
docs/docs/troubleshooting-common-errors.md Outdated Show resolved Hide resolved
docs/docs/troubleshooting-common-errors.md Outdated Show resolved Hide resolved
Copy link

@AishaBlake AishaBlake left a comment

Choose a reason for hiding this comment

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

Hey, Kyle! This looks awesome! It's going to help a ton of people. I have a bunch of notes/suggestions but only two of them are blocking: the broken link and the unfinished sentence.

docs/docs/troubleshooting-common-errors.md Outdated Show resolved Hide resolved
docs/docs/troubleshooting-common-errors.md Outdated Show resolved Hide resolved
docs/docs/troubleshooting-common-errors.md Outdated Show resolved Hide resolved
docs/docs/troubleshooting-common-errors.md Outdated Show resolved Hide resolved
docs/docs/troubleshooting-common-errors.md Outdated Show resolved Hide resolved
docs/docs/troubleshooting-common-errors.md Outdated Show resolved Hide resolved
docs/docs/troubleshooting-common-errors.md Outdated Show resolved Hide resolved
docs/docs/troubleshooting-common-errors.md Outdated Show resolved Hide resolved

## Errors building and deploying

The process of building your site [varies slightly from the development process](/docs/overview-of-the-gatsby-build-process/). Some errors can arise when you build your site if

Choose a reason for hiding this comment

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

You'll want to finish this sentence. I'm not quite sure where it was going but it sounds important. 😄

@gillkyle gillkyle requested a review from AishaBlake December 12, 2019 17:41
Copy link

@AishaBlake AishaBlake left a comment

Choose a reason for hiding this comment

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

Woo hoo!! Great work on this!


Another possibility is that empty strings are used for image paths somewhere in your site, and when Gatsby constructs a GraphQL schema it [infers](/docs/glossary#inference) the wrong type because the empty string doesn't look like a path.
Another possibility that could cause this issue is from empty strings used for image paths somewhere in your site. If this is the case, when Gatsby constructs a GraphQL schema it may [infer](/docs/glossary#inference) the wrong type because the empty string doesn't look like a file path.

Choose a reason for hiding this comment

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

👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants