Closed robbiebel closed 2 weeks ago
Hey @robbiebel - thanks for taking the time to report this.
In your report you ticked that you've disabled all other plugins except for Rank Math, WPGraphQL, and this plugin, yet your error message points to ProductVariation
, GroupProduct
and other WPGraphQL objects that are not native to WordPress or those plugins.
First: please disable all other external plugins (or custom code if that's how youre exposing those CPTs/Terms) and confirm the problem goes away.
Then:
Once we have that, we should be able to figure out the next steps to get this resolved for you.
Hey @justlevine,
Thank you for fast reply. Sorry, I thought WooGraphQL was required plugin for WPGraphQLRankMath.
After I disable WooGraphQL the error is gone.
Can you give me first sight idea because you have knowledge about interfaces?
I'm really sorry for your time. I'm closing the issue.
And last, the queries works on my client but title and description comes null but rawHead comes with them. Is it relational with that error?
Thank you
Okay, so that seems to point to an issue with WooGraphQL's types not getting properly mapped to their resolved object type for seo
and instead using the base interface
Would need to investigate further to see why exactly this is happening.
Can you please share the version of WooCommerce and WooGraphQL you have active?
And last, the queries works on my client but title and description comes null but rawHead comes with them. Is it relational with that error?
It's possible since the different child types resolve those values different, but it could also be that there's a different error that is getting obfuscated by the Interface conflict. Will know for sure once I have version numbers and can replicate.
WPGraphQL Version 1.27.0 WPGraphQL WooCommerce (WooGraphQL) Version 0.20.0 WooCommerce Version 9.1.2 Rank Math SEO with AI SEO Tools Version 1.0.223 WPGraphQL for Rank Math SEO Version 0.3.0
No any other plugin or custom code is active.
Thanks! Would you be able to update to the latest WPGraphQL (v1.27.2) and confirm the issue persists? Iirc 1.27.x had some fixes specifically for interfaces.
Yes I confirm that the error still persist with WpGraphQL Version 1.27.2
On further investigation, this is due to a combination of factors:
graphql_${object_type}_fields
filter to apply the narrowed-type (E.g. RankMathProductObjectSeo
.graphql_post_entities_allowed_post_types
to hide some WooCommerce CPTs using a custom skip_graphql_type_registry
key. WPGraphQL::allowed_post_types()
which is what we're using to detect the types (correctly, I believe 🧐) before applying the WPGraphQL-core workaround here.To be honest, I'm not entirely sure the best way to fix.
As a temporary workaround, we can check for WooGraphQL and manually apply the expected types, but that's too flaky to support long-term and probably wouldnt work for custom Woo product CPTs.
Long-term, addressing https://github.com/wp-graphql/wp-graphql/issues/3096 in would allow us to drop our workaround, but the interface inheritance lifecycle is one of the more fragile areas of the codebase, so no idea when that might happen.
Similarly, its possible that something could be done in WooGraphQL so the built-in type registration is skipped but we can still depend on WPGraphQL::allowed_post_types()
and other core methods (if that's even a correct assumption that those "child" CPTs be included), or perhaps theres a WooGraphQL-specific workaround that will allow us to automagically get the all woo CPTs that are exposed to the schema even if they're not type registered.
Description
Hello, firstly thank you for this plugin.
I'm getting error in GraphQL IDE even before run a query.
Steps to reproduce
Additional context
{ "errors": [ "Interface field ContentNode.seo expects type RankMathContentNodeSeo but ProductVariation.seo is type RankMathSeo.", "Interface field Product.seo expects type RankMathProductObjectSeo but VariableProduct.seo is type RankMathSeo.", "Interface field ContentNode.seo expects type RankMathContentNodeSeo but VariableProduct.seo is type RankMathSeo.", "Interface field Product.seo expects type RankMathProductObjectSeo but ExternalProduct.seo is type RankMathSeo.", "Interface field ContentNode.seo expects type RankMathContentNodeSeo but ExternalProduct.seo is type RankMathSeo.", "Interface field Product.seo expects type RankMathProductObjectSeo but GroupProduct.seo is type RankMathSeo.", "Interface field ContentNode.seo expects type RankMathContentNodeSeo but GroupProduct.seo is type RankMathSeo.", "Interface field Product.seo expects type RankMathProductObjectSeo but SimpleProduct.seo is type RankMathSeo.", "Interface field ContentNode.seo expects type RankMathContentNodeSeo but SimpleProduct.seo is type RankMathSeo.", "Interface field ContentNode.seo expects type RankMathContentNodeSeo but SimpleProductVariation.seo is type RankMathSeo." ] }
Plugin Version
0.3.0
WordPress Version
6.5.5
WPGraphQL Version
1.27.0
RankMath SEO Version
1.0.221
Additional enviornmental details
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have disabled ALL plugins except for RankMath SEO, WPGraphQL, and WPGraphQL for Rank Math