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

Chronoblog requires at least one post with a "cover" in frontmatter #21

Closed
macintacos opened this issue Jan 6, 2020 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@macintacos
Copy link

macintacos commented Jan 6, 2020

Sorry about that, posted this before I actually wanted to.

While editing the theme, I removed the last example post in the posts folder and got the following errors:


 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "cover" must not have a selection since type "String" has no subfields.

This can happen if you e.g. accidentally added { } to the field "cover". If you didn't expect "cover" to be of type "String" make sure that your input source and/or plugin is correct.

File: node_modules/gatsby-theme-chronoblog/src/hooks/use-feed.js:61:19


 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "cover" must not have a selection since type "String" has no subfields.

This can happen if you e.g. accidentally added { } to the field "cover". If you didn't expect "cover" to be of type "String" make sure that your input source and/or plugin is correct.

File: node_modules/gatsby-theme-chronoblog/src/templates/link.js:17:15


 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "cover" must not have a selection since type "String" has no subfields.

This can happen if you e.g. accidentally added { } to the field "cover". If you didn't expect "cover" to be of type "String" make sure that your input source and/or plugin is correct.

File: node_modules/gatsby-theme-chronoblog/src/templates/note.js:16:15


 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "cover" must not have a selection since type "String" has no subfields.

This can happen if you e.g. accidentally added { } to the field "cover". If you didn't expect "cover" to be of type "String" make sure that your input source and/or plugin is correct.

File: node_modules/gatsby-theme-chronoblog/src/templates/post.js:17:15

failed extract queries from components - 0.330s

Upon further inspection, it appears that you need at least one post with a cover image, otherwise you get that error. If you supply a post with a cover image, you don't get the error. Took me forever to figure it out, because the errors weren't exactly the most helpful thing in the world.

Is the cover field required in frontmatter? I had thought that it wasn't.

@macintacos macintacos changed the title Chronoblog requires at least one post with Chronoblog requires at least one post with a "cover" in frontmatter Jan 6, 2020
@ganevdev
Copy link
Member

ganevdev commented Jan 6, 2020

I think you are talking about this: https://github.com/Chronoblog/gatsby-theme-chronoblog#frontmatter-placeholder ?

@macintacos
Copy link
Author

Nope; I left that file alone and got the error I provided above when I removed the cover from the last post's frontmatter. The frontmatter-placeholder index file still exists and has the cover field, but gatsby develop doesn't seem to care, and the site won't render until I add the cover field to at least one post.

@russmatney
Copy link

I experienced this yesterday while moving into this theme - I couldn't get the page building again until I'd provided an image at exactly the path specified by cover in a post. Things worked great after adding an image, but beforehand the errors seem to be that the gql query handler for cover gets a String instead of an object.

@ganevdev ganevdev added the bug Something isn't working label Feb 17, 2020
@ganevdev
Copy link
Member

ganevdev commented Feb 17, 2020

Here is a test starter where this error is reproduced: https://github.com/Chronoblog/gatsby-theme-chronoblog/tree/master/tests/profile-minimal

But I still don’t understand why this is happening.

Command to run:

yarn start:profile-minimal

@ganevdev
Copy link
Member

ganevdev commented Feb 24, 2020

Thanks to the investigation by @russmatney #36 (comment), we know that this problem does not have a “right” solution. But we can do something.

So, I tried to add a real image file to the frontmatter-placeholder: https://github.com/Chronoblog/gatsby-theme-chronoblog/tree/master/tests/profile-minimal/content/links/frontmatter-placeholder, and everything seemed to work. I will add an image file to all starters.

I don’t like this solution because it relies a lot on the frontmatter-placeholder - the user can accidentally delete this folder, and then a lot of things can go wrong.

I’m thinking about maybe creating a separate place for this file? Or maybe automatically generate it every time a site is generated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants