-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[gatsby-source-contentful] possible bug? new contentful model field does not show up in graphql response #14160
Comments
I'm using gatsby-source-contentful myself, so here's just a couple of sanity checks that have helped me in the past:
Very simple checks, but just to make sure it's none of these. |
sure
thousands times, removing cache and restarting the local server too.
absolutely
yep, but it should work anyway returning a the thing is that, as I experienced it a couple of times before (e.g.: with the |
Update: I started the server 15 minutes ago and it worked, restarted it just to make sure I was not dreaming and the issue reappeared. this without making any changes to code or contentful. it's getting ridiculous :D I just recoded and uploaded a video now to show the issue in action. |
Sure seems like a bug. I dived into the code and it seems they're using a sync token to get delta updates of the contentful data. However, I can't find where the contentful data is cached (whether that's actually the If it is stored in the I'm handing it over to the core team because this is where I'm stuck and probably would require knowledge of the plugin's inner workings. |
thanks anyway @LuudJanssen. like this one: #3495 |
@pieh I believe you have more insights in this one. |
Hey, do you have any values set for that field in any of your entries? Right now we infer schema from data, so if no entry has any values, we can't infer type and that's why field is missing. There is open PR that will fix that ( #12816 ), but it didn't land yet. But in meantime please make sure at least one entry set |
I've missed some comments before my earlier reply:
as mentioned in my comment - right now we rely on inferring so if there are only
It would be great to be able to reproduce it if this happens when you have actual content in those fields, not quite sure how to approach it yet |
Looking at the code - one thing comes to mind: gatsby/packages/gatsby-source-contentful/src/gatsby-node.js Lines 138 to 144 in ec038e9
|
thank you @pieh, after this note of yours I finally got it to work after the fifth I didn't solve it earlier because, stressed out by the issue, after putting a value in an entry I tried only one time to restart it, and then erratically tried with different approaches.
so this could be the cause of the need of severals "resets" of cache and server to get it to work after an error? this is everything I get after starting the server:
thank you again @pieh and @LuudJanssen for your help PS: would it be good to expand the |
Those errors are result of missing field and not cause for it, so those won't help in tracing down potential cache issue (if there is cache issue here - hard to determine that without concrete reproduction steps that fails when at least one entry in contentful has data for that missing field).
This is general gatsby issue and not just gatsby-source-contentful. We very recently added ability in gatsby core to define fields so we don't have to rely on data, but plugin ecosystem wasn't yet adjusted to use this new API. Contentful is actually one of the first official plugins that will use that APIs (once the PR I linked above will be finished). There are already some that use those APIs - like plugins for Sanity or DatoCMS |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contributefor more information about opening PRs, triaging issues, and contributing! Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks again for being part of the Gatsby community! |
Can confirm the following which may help in reproducing:
|
I found that it looks at the entries rather than the model to figure out the schema. So after adding a new field to the model just make sure to make one of the entries have that field configured. For example, I had to add an image to my new media field to make gatsby-contentful see it. |
found a solution that worked for me. in package json add the following script and run npm run clean. cleans the cache. this is a cache issue with gatsby.
|
The only thing that worked for me was to update the content model and update / publish new content from that updated model. |
Summary
I created a new boolean field in a Contentful model and I really can't get it to show up in gatsby graphql output.
I tried the following:
.cache
folder and restartedgatsby develop
several timesgatsby-node.js
to force a cache resetand I don't know what else to try.
the project is a super simple portfolio for an illustrator.
I hope this thread is not OT, and that the issue is not because my incompetence.
If the latter is the case, I'm sorry for wasting anyone's time.
the issue is really strange, and I had it in other couple updates of other content type models, but I always solved it with the generation of a new API key.
thanks!
Relevant information
my server starts fine and I don't have any errors other than a deprecation warning
error (node:37636) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
Attached you can find a screenshot of the GraphiQL not autocompleting the
isHightlight
field, that is the one I need in this case.I tried downloading and running the Contentful boilerplate generated with the API Key, and the response is as expected.
the field is
Is highlight
, in theproject
content type:Environment
File contents
gatsby-config.js
(only plugins):gatsby-node.js
:The text was updated successfully, but these errors were encountered: