wp-graphql / wp-graphql-acf

WPGraphQL for Advanced Custom Fields
https://wpgraphql.com/acf
627 stars 123 forks source link

Relationship field query errors out when Post that it is set to is deleted #300

Closed dChiamp closed 3 years ago

dChiamp commented 3 years ago

Related to issues #85, #100.

Say you have a post relationship field called "Editor Credit" in a Post custom field group ("Work Meta"). If a selected post within that relationship field is subsequently deleted, the query will return a 500 error. This is difficult to debug because the relationship field that held the deleted post appears empty, but the error persists. I would instead expect the system to return null (which it does when logged in) and give no errors.

Example query:

query PAGES($uri: String!) {
  nodeByUri(uri: $uri) {
    ... on Page {
      title
      id
      uri
      workMeta {
        editorCredit {
          ... on Page {
            title
            id
          }
        }
      }
    }
  }
}

Results in 500 "Internal server error"

Tested on: