Gatsby: GraphQLError: Syntax Error: Unexpected Name "wordpress__complianz"

Created on 29 Jan 2020  Â·  6Comments  Â·  Source: gatsbyjs/gatsby

Hi, we just installed the complianz.io plugin on our production website (standard WordPress) and we are getting an error when building our GatsbyJS development site.

`success Downloading remote files - 149.064s - 457/520 3.49/s
success source and transform nodes - 164.366s
â ™ building schema

ERROR

UNHANDLED REJECTION Syntax Error: Unexpected Name "wordpress__complianz"

GraphQLError: Syntax Error: Unexpected Name "wordpress__complianz"

  • TypeMapper.js:113 TypeMapper.createType
    [gatsby-saig]/[graphql-compose]/lib/TypeMapper.js:113:43

  • ObjectTypeComposer.js:80 Function.createTemp
    [gatsby-saig]/[graphql-compose]/lib/ObjectTypeComposer.js:80:28

  • ObjectTypeComposer.js:56 Function.create
    [gatsby-saig]/[graphql-compose]/lib/ObjectTypeComposer.js:56:21

  • index.js:59
    [gatsby-saig]/[gatsby]/dist/schema/infer/index.js:59:41

  • Array.forEach

  • index.js:42 addInferredTypes
    [gatsby-saig]/[gatsby]/dist/schema/infer/index.js:42:13

  • schema.js:184 updateSchemaComposer
    [gatsby-saig]/[gatsby]/dist/schema/schema.js:184:9

  • schema.js:95 async buildSchema
    [gatsby-saig]/[gatsby]/dist/schema/schema.js:95:3

  • index.js:136 async Object.build
    [gatsby-saig]/[gatsby]/dist/schema/index.js:136:18

  • index.js:419 async module.exports
    [gatsby-saig]/[gatsby]/dist/bootstrap/index.js:419:3

  • develop.js:422 async module.exports
    [gatsby-saig]/[gatsby]/dist/commands/develop.js:422:7

â ™ building schema`

Is there a way to remove complianz from GraphQL?

not stale GraphQL WordPress

Most helpful comment

@vladar, I'm sure there's a way but it would be decently complex and site-specific. A custom normalizer could be used to rename the problematic typenames but it would likely need to be a recursive script that could get expensive. I'm glad we'll be deprecating using Gatsby and the REST API, because there are many problems like this that we can't reasonably account for on our side that are inherent to using an untyped REST API. I would say the best way around this right now is to use gatsby-source-graphql with WPGraphQL like you're doing @kosvrouvas. Good news about that is that the new major version of gatsby-source-wordpress will be more similar to gatsby-source-graphql/WPGraphQL than it is to the current version of gatsby-source-wordpress, so upgrading from that will be easier for you anyway @kosvrouvas.

All 6 comments

I think this falls into similar category as https://github.com/gatsbyjs/gatsby/issues/20596 (not exactly the same, but type name provided by plugin seems to fail validation)

This type name is also auto generated by wordpress plugin (similar as in the issue I linked)

/cc @vladar

@pieh Yeah, it is highly likely that type name contains space here (like: wordpress__complianz something) so it fails type name validation.

@TylerBarnes any idea how can we override bad type names coming from gatsby-source-wordpress? I don't think we can fix this using schema customization.

_Although it doesn't solve this, I was able to get around it sourcing data via wpgraphql._

@vladar, I'm sure there's a way but it would be decently complex and site-specific. A custom normalizer could be used to rename the problematic typenames but it would likely need to be a recursive script that could get expensive. I'm glad we'll be deprecating using Gatsby and the REST API, because there are many problems like this that we can't reasonably account for on our side that are inherent to using an untyped REST API. I would say the best way around this right now is to use gatsby-source-graphql with WPGraphQL like you're doing @kosvrouvas. Good news about that is that the new major version of gatsby-source-wordpress will be more similar to gatsby-source-graphql/WPGraphQL than it is to the current version of gatsby-source-wordpress, so upgrading from that will be easier for you anyway @kosvrouvas.

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  Â·  3Comments

andykais picture andykais  Â·  3Comments

brandonmp picture brandonmp  Â·  3Comments

ferMartz picture ferMartz  Â·  3Comments

theduke picture theduke  Â·  3Comments