# Query unreleased preview documents

**URL:** <https://community.prismic.io/t/query-unreleased-preview-documents/4363>\
**Category:** Developing with Prismic\
**Tags:** nextjs\
**Created:** [March 4, 2021, 1:05am UTC](https://community.prismic.io/t/query-unreleased-preview-documents/4363 "2021-03-04T01:05:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![allan](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/allan/32/8531_2.png) [@allan](https://community.prismic.io/u/allan)\
**Post date:** [March 4, 2021, 1:05am UTC](https://community.prismic.io/t/query-unreleased-preview-documents/4363/1 "2021-03-04T01:05:52Z")

</div>

Hi,

we are running Next.js/react and have some middleware to query preview documents before displaying the preview page.

Currently this works fine if the the document has previously been published, but it can't seem to find new unpublished documents (previewing the release of an import).

We are getting the documentId from the preview queryString and using it like `Prismic.Predicates.at('document.id', documentId)`.

Does the query need to be altered for unreleased preview documents?

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [March 10, 2021, 10:35am UTC](https://community.prismic.io/t/query-unreleased-preview-documents/4363/4 "2021-03-10T10:35:13Z")

</div>

Hi Allan,

Sorry about the delay in the reply. What you're describing sounds like what you're describing is that the preview script is not added in the 404 page of your application. You'll need to load this here so the website application can access the linkresolver and redirect to the correct page.

We talk about this and other common preview issues here:

> **[Troubleshooting: Previews](https://user-guides.prismic.io/en/articles/3403530-troubleshooting-previews)**
>
> Are your Prismic previews not working? Here we'll show you some common checks to get your previews up and running again.

Thanks.

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [March 19, 2021, 2:22pm UTC](https://community.prismic.io/t/query-unreleased-preview-documents/4363/6 "2021-03-19T14:22:21Z")

</div>

This issue has been closed due to inactivity. [Flag to reopen](https://community.prismic.io/t/re-open-a-thread/2175).

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 4:27pm UTC](https://community.prismic.io/t/query-unreleased-preview-documents/4363/7 "2021-12-09T16:27:32Z")

</div>


