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

Retrieving trashed post translation causing error

Open daniyals14 opened this issue 5 years ago • 1 comments

Hello, im trying to retrieve translations on post with uri which does not have a translation and it's giving me the following internal server error

post(id: "xyz", idType: URI) {
      id
      language {
        locale
      }
      translations {
        link
        language {
          locale
        }
        uri
      }
    }

when i remove uri from the graphql, the query returns fine. If theres a translation against the post, the query works fine.

"errors": [
    {
      "message": "Internal server error",
      "path": [
        "wpgraphqlbuildings",
        "post",
        "translations",
        0,
        "uri"
      ],

daniyals14 avatar Feb 19 '20 12:02 daniyals14

This error appears in the graphqli of the gatsby project but it works fine on the graphqli on the wp blog, could it be cache issue?

Graphql & Response on wp blog graphqli

post(id: "xyz", idType: URI) {
    language {
      locale
    }
    translations {
      language {
        locale
      }
      uri
      status
    }
  }

Response:

{
  "data": {
    "post": {
      "language": {
        "locale": "en_US"
      },
      "translations": [
        {
          "language": {
            "locale": "ar"
          },
          "uri": "ar/__trashed-16/",
          "status": "trash"
        }
      ]
    }
  }
}

daniyals14 avatar Feb 19 '20 13:02 daniyals14