Preview returning 500 api_internal_error

Hello

Our content writers have informed me that the Prismic preview functionality has stopped working for draft documents.

We have started receiving the following response from the GraphQL API when previewing a draft document:

{"type":"api_internal_error","message":"Unexpected error"}

GraphQL Query:

query PRISMIC_DOCUMENT {
  pDocuments: _allDocuments(id: "YmATZhIAACUA6eOx", lang: "en-us") {
    edges {
      node {
        ...meta
        __typename
      }
    }
  }
}
fragment meta on _Document {
  _meta {
    id
    lang
    tags
    type
    uid
  }
  __typename
}

Prismic-Ref: "Yl_cMBIAACEA6Oqd:YmAVhRIAACMA6evQ"

I have also tried the REST API and receive a 500:

https://xxx.prismic.io/api/v2/documents/search?access_token=xxx&ref=Yl_cMBIAACEA6Oqd%3AYmAVhRIAACMA6evQ&q=%5B%5Bat(document.id,%20%22YmATZhIAACUA6eOx%22)%5D%5D

I have omitted our repository name and access token from the above requests but I can assure you they are correct.

Our issue appears similar to the following, which needed to be resolved internally by your DevOps team:

Is this something you can help with?

I should add that we have since published another piece of content and the draft preview functionality has stopped 500ing.

Hello @martin1, thanks for reaching out. Maybe this is related to the cache in the browser. You'll need to delete the preview cookie. Also, make sure to always exit the previews correctly using the ‘X’ on the preview module on the bottom left.