question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

There was an error in your GraphQL query:

Field “headerImage” must not have a selection since type “String” has no subfields.

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

gatsby-config.js 👇🏻

plugins: [
    "gatsby-plugin-sharp",
    "gatsby-transformer-sharp",
    {
      resolve: "gatsby-transformer-remark",
      options: {
        plugins: [
          "gatsby-remark-relative-images",
          {
            resolve: "gatsby-remark-images",
            options: {
              maxWidth: 750,
              linkImagesToOriginal: false,
            },
          },
        ],
      },
    },
    "gatsby-plugin-react-helmet",
    {
      resolve: "gatsby-source-filesystem",
      options: {
        name: "images",
        path: `${__dirname}/src/images`,
      },
    },
    {
      resolve: "gatsby-source-filesystem",
      options: {
        name: "src",
        path: `${__dirname}/src/`,
      },
    },

.md 👇🏻

pluginName: Unsplash
pluginLogo: ../images/unsplash_logo.jpeg
headerImage: ../images/unsplash_header.jpeg
creatorName: Unsplash
creatorImage: ../images/unsplash_creator.png
pluginLink: https://www.figma.com/community/plugin/738454987945972471/Unsplash

query👇🏻

query($slug: String!) {
    markdownRemark(fields: { slug: { eq: $slug } }) {
      html
      frontmatter {
        pluginName
        headerImage {
          childImageSharp {
            fluid(maxWidth: 340) {
              ...GatsbyImageSharpFluid
            }
          }
        }
      }
    }
  }

P.S. did go through similar issues. did not help…

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
beingabstraccommented, Apr 13, 2020

Fixed it! Thanks.

0reactions
sekyocommented, Oct 18, 2022

In my case I just had to remove unneeded square brackets in my request

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to work around GraphQL error, field "x" must not have a ...
Field "url" must not have a selection since type "String" has no subfields. Does anyone have any suggestions on how to work around...
Read more >
Field \"songs\" must not have a selection since type \"[String ...
\" has no subfields. I'm getting the above error when doing a query on GraphQL. I ...
Read more >
Troubleshooting Common Errors - Gatsby
This error message Field "image" must not have a selection since type "String" has no subfields. comes up when a GraphQL query is...
Read more >
Validation - GraphQL
That type does not have a favoriteSpaceship field, so this query is invalid: ... "message": "Field \"name\" must not have a selection since...
Read more >
“Field “image” must not have a selection since type “String ...
Error: “Field “image” must not have a selection since type “String” has no subfields." · Reconfigure the gatsby-config so that plugin-sharp and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found