pristas-peter / wp-graphql-gutenberg

Query gutenberg blocks with wp-graphql
https://wp-graphql-gutenberg.netlify.app
GNU General Public License v3.0
299 stars 62 forks source link

Schema error #98

Open tim9009 opened 3 years ago

tim9009 commented 3 years ago

Hello, I have what I believe to be a schema related problem. I get the following error message when going to http://localhost/graphql in my browser (project path replaced with *****):

Fatal error: Uncaught Error: Cannot use object of type GraphQL\Type\SchemaConfig as array in *****/wp-content/plugins/wp-graphql-gutenberg/src/Schema/Types/BlockTypes.php:248 Stack trace: #0 *****/wp-includes/class-wp-hook.php(287): WPGraphQLGutenberg\Schema\Types\BlockTypes->WPGraphQLGutenberg\Schema\Types\{closure}(Object(GraphQL\Type\SchemaConfig)) #1 *****/wp-includes/plugin.php(212): WP_Hook->apply_filters(Object(GraphQL\Type\SchemaConfig), Array) #2 *****/wp-content/plugins/wp-graphql/src/WPSchema.php(50): apply_filters('graphql_schema_...', Object(GraphQL\Type\SchemaConfig)) #3 *****/wp-content/plugins/wp-graphql/src/Registry/SchemaRegistry.php(50): WPGraphQL\WPSchema->__construct(Object(GraphQL\Type\SchemaConfig)) #4 *****/wp-content/plugins/wp-graphql/src/WPGraphQL. in *****/wp-content/plugins/wp-graphql-gutenberg/src/Schema/Types/BlockTypes.php on line 248

Trying to access the graphql endpoint via GraphiQL returns this standard WordPress error message (in Norwegian in this case):

{ "code": "internal_server_error", "message": "<p>En kritisk feil har inntruffet på dette nettstedet.</p><p><a href=\"https://wordpress.org/support/article/debugging-in-wordpress/\">Lær mer om feilsøking i WordPress.</a></p>", "data": { "status": 500 }, "additional_errors": [] }

My wpgrapql stack wp-graphql wp-graphql-acf wp-graphql-gutenberg wp-graphql-gutenberg-acf wp-graphql-polylang add-wpgraphql-seo

What I think triggered the error I hit the "Update block registry" button in wp-admin. This has killed the website several times before too, but i has usually "fixed itself" somehow after a while.

What I have tried I have tried deactivating and reactivating various wpgraphql plugins. Disabling wp-graphql-gutenberg removes the 500 error, but then I can't access block data obviously. Only disabling wp-graphql-gutenberg-acf makes no difference.

tim9009 commented 3 years ago

Alright so I have been working on trying to get this working for many hours and not I've got it working again. I tried to update wp-graphql, which did not work, then I downgraded to v.1.0 and now it works for some reason. Also worth noting is that the ACF blocks are not added to the schema before you actually save a post. That should probably happen on plugin activation, though that's an issue with wp-graphql-gutenberg-acf.

rauluranga commented 3 years ago

we also have this problem in our environment, here is what we did to fix this issue:

upgrade wordpress to v5.7.2 upgrade wp-graphql to v1.4.3 upgrade wp-graphql-gutenberg to v0.3.8