wp-graphql-polylang icon indicating copy to clipboard operation
wp-graphql-polylang copied to clipboard

Internal server error when querying an author using nodeByUri

Open LarsEjaas opened this issue 1 year ago • 0 comments

I am trying to do a seedQuery as described here: https://faustjs.org/reference/seed-query When I do this for a author URL with the format: blog/author/<authorName> I get a server error when the wp-graphql-polylang plugin is activated.

Steps to reproduce:

  1. Set permalink structure to: /blog/%postname%/
  2. Activate the Polylang plugin and the WPGraphQL plugin.
  3. Do the following query from within the WPGraphiQL IDE in WordPress Admin(this was simplified a lot - but enough to trigger the error):
query GET_NODE_BY_URI( $uri: String! = "") {
  ... on RootQuery {
    node: nodeByUri(uri: $uri) {
      uri
      id
    }
  }
}

Variables:
{ "uri": "blog/author/<author-name>" }

This will return the following data:

  "data": {
    "node": {
      "uri": "/blog/author/ejaasheadless/",
      "id": "dXNlcjox"
    }
  }
  1. Activate the WP GraphQL Polylang plugin and execute the query from within the WPGraphiQL IDE again. This will return the following error:
"debugMessage": "WPGraphQL\\Registry\\TypeRegistry::get_type(): Argument #1 ($type_name) must be of type string, null given, called in /var/www/html/wp-content/plugins/wp-graphql/src/Type/InterfaceType/UniformResourceIdentifiable.php on line 59",
     "message": "Internal server error",

I have tested on:

  • WordPress v. 6.3.2
  • WPGraphQL v. 1.17.0
  • Polylang v. 3.5.1
  • WP GraphQL Polylang v. 0.6.0

LarsEjaas avatar Oct 23 '23 18:10 LarsEjaas