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

[gatsby-source-wordpress] GraphQL Error Unknown type "acf_post_photo" #5049

Closed
williharder opened this issue Apr 19, 2018 · 4 comments
Closed
Labels
type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@williharder
Copy link

When I run gatsby develop I get a GraphQL error regarding the ACF fields and on the frontend I get an error message.

bildschirmfoto 2018-04-19 um 20 12 57

The shown error message in the terminal console reads
GraphQL Error Unknown type "acf_post_photo".

I started a Gatsby App & WordPress Site from scratch and copied carefully the everything in order. I also changed the acf field names in the backend and in templates/post.js

bildschirmfoto 2018-04-19 um 20 01 22

When I delete all code respective to ACF from templates/post.js the app builds just fine and all regular wordpress content is shown.

The curios thing is, that when I run a query from GraphiQL it successfully pulls all the acf fields and content.

bildschirmfoto 2018-04-19 um 20 20 55
bildschirmfoto 2018-04-19 um 20 21 32

These are all my plugins in WordPress

bildschirmfoto 2018-04-19 um 19 51 10

This is my edited code from templates/post.js

There were already several similar issues, though none brought a solution. Hopefully somebody can help? (Sorry about not keeping it short 🌚)

@pieh
Copy link
Contributor

pieh commented Apr 19, 2018

Query in code you linked is different then the one you show in issue. You use inline fragmets in your code - but those are meant for union types and defenitely won't work - you should use same query as You used in GraphiQL (as in same fields)

@williharder
Copy link
Author

williharder commented Apr 19, 2018

But that's what I don't get. In the example source code from [gatsby-source-wordpress] inline fragments are also used. In the documentation for the plugin its being done this exact way for ACF Flexible Content.

@pieh
Copy link
Contributor

pieh commented Apr 19, 2018

Oh, I didn't catch it is flexible content - so problem here is You use only single type - gatsby will not create Union for single type (and when union is created that's when inline fragments are needed). So if you will have more content of different type in your flexible field (it doesn't have to be in same post) then union will be created and you will need inline fragments.

@m-allanson m-allanson added the type: question or discussion Issue discussing or asking a question about Gatsby label Apr 20, 2018
@KyleAMathews
Copy link
Contributor

Due to the high volume of issues, we're closing out older ones without recent activity. Please open a new issue if you need help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question or discussion Issue discussing or asking a question about Gatsby
4 participants