Gatsby-theme-novela: yarn build is failing

Created on 5 Sep 2019  路  20Comments  路  Source: narative/gatsby-theme-novela

Version of Novela you are using
^0.*

Number of posts you have and which data source
2, Contentful

Describe the bug
yarn build fails

Logs

"gatsby-plugin-feed" threw an error while running the onPostBuild lifecycle:

Cannot query field "secret" on type "Article".

GraphQL request:11:23
10 |                       author
11 |                       secret
   |                       ^
12 |                     }

Expected behavior
Should build successfully

Browser

  • Chrome

Most helpful comment

It think that it has something to do with Contentful because when using local it works. Maybe double check secret field on contentful. I don't know how it works, but I would look there.

All 20 comments

Nope, yarn dev works fine, but yarn build is failing

It think that it has something to do with Contentful because when using local it works. Maybe double check secret field on contentful. I don't know how it works, but I would look there.

@smakosh it could be out Contentful export is out of date. I've exported latest.

make sure on Secret field in Contentful you select yes or no.

Yup it is selected but the build still fails
Screen Shot 2019-09-06 at 9 01 33 AM

somehow that schema doesn't contain secret field
Screen Shot 2019-09-06 at 9 11 32 AM

You should check if the user wants to use local or contentful as source of content and then use the right query, so here you should query allContentfulPost instead, I'll open a PR to handle this

@smakosh We need that field for the RSS feed to not include secret posts. The issue seems to be with contentful and secret, not with the query for the RSS

I did.

Even if you change the query, you would still need the secret field meaning the query remains the same.

changing the query works fine 馃憣

With secret field inside ?

Screen Shot 2019-09-06 at 9 19 39 AM

Hmm.. but shouldn't the original query return the same results for local and contentful? I still think that the issue lies somewhere else. Maybe @brotzky can shed some light on this, since I don't know about how contentful is implemented in this theme.

If the original query allArticle works by removing the secret field, and this one allContentfulPost works with the secret field, that means that the issue is somewhere else.

After doing some research I conclude that I was wrong :) We should find a way to use allContentfulPost if the source is contentful otherwise local, as you said.

I'm trying to access themeOptions from gatsby-config.js but fail miserably, can you advice if I can actually access it as you did on gatsby-node.js?

Nvm, I managed to achieve that

Great PR

we do have different queries for Contentful and Local data. Contentful is annoying in that it wont create the node field unless there is a value set in Contentful.

https://github.com/narative/gatsby-theme-novela/blob/master/%40narative/gatsby-theme-novela/gatsby/data/data.query.js#L96

Yup that's where I come up with the idea of the solution 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bravo-kernel picture bravo-kernel  路  4Comments

KrisBraun picture KrisBraun  路  4Comments

mwood23 picture mwood23  路  4Comments

zactony picture zactony  路  3Comments

slorber picture slorber  路  3Comments