Background of the issue:
I frequently use `nodeByUri` from WPGraphQL to query node content, especially when the post type is unknown to the front end. I was attempting to use the following queries:
query GetPageById {
page(id: "/", idType: URI) {
id
title
content
}
}
query GetNodeByUri {
nodeByUri(uri: "/") {
id
... on Page {
title
content
}
}
}
Symptoms:
When using `page(…)` or `post(…)` everything works as expected, but after updating to WPML WPGraphQL 1.1.0 I get an error message. Queries to `page` and `post` result in the expected data:
{
"errors": [
{
"debugMessage": "item should be a Collection or an array or an object",
"message": "Internal server error",
"extensions": {
"category": "internal"
},
"locations": [
{
"line": 10,
"column": 3
}
],
"path": [
"nodeByUri"
]
}
],
"data": {
"nodeByUri": null
},
"extensions": {
"debug": [
{
"type": "DUPLICATE_FIELD",
"message": "You cannot register duplicate fields on the same Type. The field 'language' already exists on the type 'page'. Make sure to give the field a unique name.",
"field_name": "language",
"type_name": "page",
"existing_field": {
"type": {},
"description": "ContentNode language",
"resolve": [
{
"helpers": {}
},
"resolveLanguageField"
],
"name": "language"
},
"duplicate_field": {
"type": "Language",
"description": "Page language",
"resolve": [
{
"helpers": {}
},
"resolveLanguageField"
]
},
…
Questions:
Why does `nodeByUri` return an internal server error after updating to WPML WPGraphQL 1.1.0?
How can I resolve the 'duplicate fields' error for the 'language' field on the 'page' type?