wp-graphql / wp-graphql

:rocket: GraphQL API for WordPress
https://www.wpgraphql.com
GNU General Public License v3.0
3.66k stars 443 forks source link

Error when wp-graphql-gutenberg plugin is enabled #1460

Closed james-wfaa closed 3 years ago

james-wfaa commented 4 years ago

When both WP Graphql 0.10.3 and WP Graphql Gutenberg 0.3.4 https://github.com/pristas-peter/wp-graphql-gutenberg are active, the following error occurs when running gatsby develop:

Missing onError handler for invocation 'building-schema', error was 'Error: Type with name "WpBlockAttributesObject" does not exists'. Stacktrace was 'Error: Type with name "WpBlockAttributesObject" does not exists

Earlier in the process, this warning occurs: warn gatsby-source-wordpress Unable to find a single Node query for BlockEditorContentNode This type will not be available in Gatsby.

jasonbahl commented 4 years ago

@james-wfaa when using WPGraphQL and WPGraphQL Gutenberg are there errors when using WPGraphiQL in the WordPress admin?

If you're not having issues with WPGraphQL directly, then it's likely an issue with the Gatsby Source WordPress plugin.

There are a few issues related to Gutenberg here: https://github.com/gatsbyjs/gatsby-source-wordpress-experimental/issues?q=is%3Aissue+gutenberg+

If none of those are relevant, I'd recommend opening a new issue on that repo with as much detail as possible to reproduce.

james-wfaa commented 4 years ago

@jasonbahl I was able to circumvent the issue and start getting gatsby develop to work while the wp-graphql-gutenberg plugin is active. I didn't test thoroughly, but I think the problem was with having both wp-graph-gutenberg AND another plugin called atomic blocks active. https://atomicblocks.com/. When I disabled atomic blocks, I was able to run gatsby develop without errors.

Kpudlo commented 4 years ago

I am experiencing the same issues. However, after disabling all plugins except WP GraphQL, WP Gatsby, and WP GraphQL Gutenberg, I'm still unable to get gatsby develop to work correctly. As soon as I disable WP GraphQL Gutenberg, I am able to run gatsby develop.

jasonbahl commented 4 years ago

@Kpudlo are you able to run queries using WPGraphQL outside of Gatsby or is there an error with the WPGraphQL endpoint itself?

If there are errors using WPGraphQL directly (outside of Gatsby), please provide as much information as you can so I can reproduce and experience the same errors. If WPGraphQL alone appears to be working ok, but it's an issue related specifically to Gatsby + WordPress, then I'd recommend opening an issue with as much detail as possible on the Gatsby Source WordPress Experimental source plugin repo: https://github.com/gatsbyjs/gatsby-source-wordpress-experimental/issues

willem-aart commented 3 years ago

Ran into the same issue, solved it for now by putting the following hack in gatsby-node.js:

exports.createSchemaCustomization = ({ actions }) => {
  const { createTypes } = actions;
  const typeDefs = `
    type WpBlockAttributesObject {
      foobar: String
    }
  `;
  createTypes(typeDefs);
};

It's nasty, but better than a broken website.

bhardie commented 3 years ago

This appears to be a consumer issue and not a WPGraphQL issue. If you have more information that suggests otherwise, please open a new issue and include the new info and steps to reproduce.

dardub commented 11 months ago

I run into this issue when using WP Gatsby with WP GraphQL and WP GraphQL Gutenberge out of the box.

justlevine commented 11 months ago

Hey, @dardub this issue was closed 2 years ago.

WPGraphQL Gutenberg is no longer maintained, but feel free to see and leave feedback on the linked issue right above your most recent comment.

If you find an issue with WPGraphQL core please feel free to open up a new issue with replication steps. (WPGatsby development is handled by Gatsby in its own repo)