Skip to content
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

Cannot query localFile on wordpress__wp_media #5377

Closed
bogdancss opened this issue May 11, 2018 · 3 comments
Closed

Cannot query localFile on wordpress__wp_media #5377

bogdancss opened this issue May 11, 2018 · 3 comments

Comments

@bogdancss
Copy link
Contributor

hello - I was following the example provided in the wordpress plugin, however when I tried adding the localFile part to my query I get GraphQL Error Unknown field 'localFile' on type 'wordpress__wp_media'

         featured_media {
            source_url
            localFile {
              childImageSharp {
                sizes(maxWidth: 500) {
                  ...GatsbyImageSharpSizes_withWebp
                }
              }
            }
          }
@m-allanson
Copy link
Contributor

Hey @b0gd4n, it's really difficult to help with the amount of information here. Could you open a new issue and fill out the issue template? Ideally post a link to a GitHub repo that demonstrates the problem. Thanks.

In the meantime, this issue might be useful? #2492

@filipetedim
Copy link

I've created a more detailed issue for this, as I am having exactly the same problem out of nowhere: #6273

@sarahannnicholson
Copy link
Contributor

To add some more details to this...

I know Gatsby dynamically creates the schemas from your data source(s), but is there something on wordpress's side I need to do in order to see the localFile property in featured_media?

I've been trying to understand why localFile isn't present in my schema for a while now. And I am constantly seeing examples like in the Gatsby gatsby-source-wordpress plugin docs. But when I copy a query like this:

{
  allWordpressPost {
    edges {
      node {
        title
        featured_media {
          localFile {
            childImageSharp {
              fixed{
                src
              }
            }
          }
        }
      }
    }
  }
}

into my GraphiQL editor, I get this error:

{
  "errors": [
    {
      "message": "Cannot query field \"localFile\" on type \"wordpress__wp_media\".",
      "locations": [
        {
          "line": 8,
          "column": 11
        }
      ]
    }
  ]
}

Both @m-allanson and @filipetedim links are regarding acf fields and featured_media which isn't quite the same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants