-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
error GraphQL Error Field [type Image] must not have a selection since type "String" has no subfields. #2050
Comments
@ChandlerMBing This is a Gatsby issue, not related to Netlify CMS. It's probably related to the fact that Netlify CMS uses absolute paths and Gatsby expects relative paths. Take a look at https://www.npmjs.com/package/gatsby-remark-relative-images, but be warned it is a deep dark rabbithole. |
Thanks for explaining the issue, I shall brace myself for the rabbithole then. |
@ChandlerMBing My advice is to concentrate on getting a single image working. That error is occurring because the image file doesn't exist at the path, so it is left as a string instead of being transformed into an image node. While trying to get it working, make sure you keep clearing Gatsby's cache so that it re-evaluates any changes. I would advise you first make sure images are loading and displaying properly in the CMS, then move to getting them working in Gatsby. Much easier than doing this the other way around because there is much less you can tweak in the CMS. Also be aware you will need to use a separate function from the library I linked to if you want to use images within your markdown (not just as field values). Good luck. It does work, but you'll probably pull some hair out on the journey. |
@Undistraction That's the thing, in production and in the cms it works just fine, it only breaks when I run gatsby develop. |
@ChandlerMBing did you figure this out? |
@erquhart Yup, it was 100% user error, I didn't clean the cache because I was running the localhost with |
Really? I have the same error but in prod, the build failed every time I pick an image from the media library, it works fine if I upload a new image, because in the second case the image is saved with a relative path as gatsby probably expected. I added the issue on the starter I'm using, decaporg/gatsby-starter-decap-cms#201 but maybe it's more about netlify cms? |
I started seeing this error today after updating my packages. The only thing that worked for me was downgrading gatsby to version |
I've been having the same issues on Gatsby with headless WP and Gatsby with Netlify CMS. Was working fine before but not now |
I updated NetlifyCMS to 2.8.0 yesterday and updated everything else to fix another issue I was told about on Gitter, and this has since broken my images too. They're all appearing as strings now, so I can't use gatsby-image. They're all just coming out as strings no matter what I try. |
Should be fixed in |
Describe the bug
After adding or changing the picture in a
Image
widget inside the cms, the local environment fails to build while production builds just fineTo Reproduce
Expected behaviour
local environment successfully builds the site
Screenshots
Error in browser

Two queries in graphiql one is treating img as string the other is copy of the query from the template file


Here's the frontmatter for index.md

My File Structure [pretty much standard gatsby]

Gatsby-source-filesystem settings for images and uploads


Query in template file

Applicable Versions:
CMS configuration
Additional context
Sometimes it works sometimes it doesn't, I tried re-running gatsby develop, changing gatsby filesystem plugin path for images from src to static, deleting cache and everything else in the
application
tab in dev tools. Tried to find something online but couldn't so it's either some weird obscure bug that no-one has ever encountered or, hopefully, I messed something up somewhere. 🙄The text was updated successfully, but these errors were encountered: