Gatsby: Plugin default-site-plugin returns an error when invalid pages are created

Created on 17 Nov 2017  Â·  12Comments  Â·  Source: gatsbyjs/gatsby

I'm running thought the tutorial to create a blog and I keep getting this error which is not particularly helpful.

screen shot 2017-11-16 at 8 20 36 pm

Most helpful comment

I improved the error so it shows the actual source of the error — your site's gatsby-node.js. default-site-plugin is the internal name for gatsby-node.js but that's super confusing :-( Sorry about how long it took to fix this!

All 12 comments

Update: I was working with the createPages api and the markdown plugin. What I realized was that I was calculating more posts than I actually has so the function was returning that errors. I have fixed the issue in my code however there should be a more informative error handling. I'm going to keep this open for @KyleAMathews to give his thoughts.

Usually the error is a result of something mispelled in your gatsby-node.js. Please correct me if I am wrong.

oh interesting! Yeah, this comes up fairly often — someone complains about default-site-plugin returning an error but this makes sense that it'd be an invalid page causing trouble.

I'll assign this to myself to look into. Probably we need better validation when creating pages to catch the problem earlier.

Could you create a small site reproducing the error? Or describe in detail how you were creating the invalid pages?

Same error with same work. I am also new to gatsby trying to run blog tutorial but getting the same error. How should I resolve it.

@KyleAMathews check out this link this is what exactly I am doing. markdown-tutorial But there is small difference in naming the files and folders

Markdown file - src/pages/home.md
template file -src/templates/home.js

@nodox Can u tell me exactly where were u wrong because I have checked twice and I can't find any misspelled words. and still am fighting to solve this error.

I would have to reproduce the error via commit messages (which I'm not sure how I introduced/fixed in the first place). I find that if you misspell something or miss a comma it'll cause the error. The problem is that it needs to build with a programmer error as any operational error will break the bootstrap build.

@KyleAMathews I believe you might be right on this one. While the server was on I kept creating and deleting markdown pages to get stuff working with my GraphQL queries. I will look into how I can reproduce this error.

@nodox I have figured out the error. and yes I agree with you, I missed the comma in gatsby-node.js.

I found another 'user error' that resulted in this useless error message.

I was adding markdown, per https://www.gatsbyjs.org/docs/adding-markdown-pages/, but decided that for my purposes I didn't need dates. I wasn't making a blog, i just wanted MD pages.

However, I had left behind "sort: { order: DESC, fields: [frontmatter___date] }" in the gatsby-node.js file from my copy-paste. Since there was no date field, this fired an error. The subsequent promise rejected them, resulting in the useless message. Adding a console.log of the result in the promise then revealed it.

I improved the error so it shows the actual source of the error — your site's gatsby-node.js. default-site-plugin is the internal name for gatsby-node.js but that's super confusing :-( Sorry about how long it took to fix this!

screenshot from 2018-09-02 19-21-04
screenshot from 2018-09-02 19-21-21
screenshot from 2018-09-02 19-21-26

Hello -

Thank you for revert back to me.

I have downloaded gatsby folder and i reach to /www directory. I run "yarn install" command , it works fine.
when i run "yarn run develop" then i am getting errors.

Regards
Aman

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Oppenheimer1 picture Oppenheimer1  Â·  3Comments

dustinhorton picture dustinhorton  Â·  3Comments

rossPatton picture rossPatton  Â·  3Comments

timbrandin picture timbrandin  Â·  3Comments

magicly picture magicly  Â·  3Comments