Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

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

Closed
dChiamp opened this issue Nov 5, 2021 · 0 comments · Fixed by #301
Closed

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

dChiamp opened this issue Nov 5, 2021 · 0 comments · Fixed by #301

Comments

@dChiamp
Copy link

dChiamp commented Nov 5, 2021

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:

  • WordPress 5.8.1
  • Advanced Custom Fields 5.10.2
  • WP GraphQL 1.6.7
  • WPGraphQL for ACF 0.5.2
rsm0128 added a commit to rsm0128/wp-graphql-acf that referenced this issue Nov 10, 2021
jasonbahl added a commit that referenced this issue Nov 10, 2021
…-deleted

Fix: Internal server error 500 for relationship to non-published post
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant