-
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
WIP: fix(gatsby-source-contentful) No Contentful assets causes build failures #21693
Conversation
You mean when user defines the type? IMO this should be the way to go here instead of creating "mock" asset node, that might mean making fixes (or changes) in gatsby core to fix the issue you are talking about. Can you clarify what kind of issues you saw? |
Well specifically we can't add it with the
In |
I updated the code's default asset creation to instead call createNode directly. On the positive side this looks much cleaner, on the down side it causes a warning to be logged because I didn't actually add an item.
Still, at least this would allow a user with a brand new contentful space to have a build pass immediately after adding the plugin. 😖 course now the starter tests failed. Is there a spot after this that would create schema definitions? |
This sounds wrong. Can you clarify a bit what do you mean by this? Do you get an error or some kind of warning? One of the reasons why schema customization API was added in the first place is to fix this issue with missing content. But it shouldn't break at all when content exists. |
c89792f
to
160aee0
Compare
If you attempt to create the type in the
As far as I can tell defining the adding the type early clashes with the createNode later on. I was hoping it'd recognize the type and merge the schemas. An alternate fix seems to be to just remove the graphQL rule that validates the fragments. The fragments get created, and if used in a query will cause the same error message to be thrown, it'll just happen at run time instead of build time. Would I be correct that the unfortunate side effect of removing this rule is that |
160aee0
to
3d890e3
Compare
Hi @joshuagagne . It looks like this PR is still a wip (as also suggested by the title). I'm going to put it in Draft mode. This won't change much for you. You can pull it out of draft mode at any time when you feel the PR is ready and people that were involved in the PR will still see the updates and everything. Thanks! |
Description
Inlines an image to guarantee build has an image to infer the model around.
Not the biggest fan of this solution.
Also tried to get a schema typed before hand to guarantee the schema types existed, but that runs into problems where multiple schema types of the same name exist.
This does not actually make the fragments pass when executed on inside a query, as this mock item doesn't actually exist in Contentful the resolved urls are not accurate. I toyed with the idea of actually having a local gatsby image file to reference if no assets are found.
Related Issues
Fixes #16455
Fixes #15397