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

Warn if context values passed to createPage are different types than others or empty #4360

Open
KyleAMathews opened this Issue Mar 5, 2018 · 4 comments

Comments

Projects
None yet
6 participants
@KyleAMathews
Contributor

KyleAMathews commented Mar 5, 2018

Someone creating pages could run into a mysterious GraphQL error if any of the pages context has missing information:

Errors:
GraphQLError: Variable "$slug" of required type "String!" was not provided.

This is hard for someone new to Gatsby to debug. We should check against this and warn.

@mainframev

This comment has been minimized.

mainframev commented May 7, 2018

yeah, right now have this issue, trying to fix, but without result :(

@BerlinaLI

This comment has been minimized.

BerlinaLI commented Jul 19, 2018

i encounter this issue and found out it is because i didnot write slug in graphql query in the create page function in my gatsby node file

@Jonqth

This comment has been minimized.

Jonqth commented Sep 4, 2018

Hi @KyleAMathews wanted to know if there's any update on this.

I'm using a starter for dato, my request in gatsby-node.js work just fine with gatsby develop although the error is till log when building.

When i try gatsby build the same exact error you mentioned pops up, as if there's no context provided to my request.

EDIT: So, not so long after posting this i found that the problem came from overriding what createPage() does in gatsby-node.js by having my components inside /pages when for the contextto be actually passed onto the template the component needs to be inside /templates

@peterjaap

This comment has been minimized.

peterjaap commented Nov 10, 2018

@Jonqth thanks so much for that last edit. Finally fixed this issue after hours of hunting..!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment