# Preview mode cookie missing from non-local environment

**URL:** <https://community.prismic.io/t/preview-mode-cookie-missing-from-non-local-environment/15527>\
**Category:** Developing with Prismic\
**Tags:** nextjs, preview-cookies\
**Created:** [March 21, 2024, 12:20am UTC](https://community.prismic.io/t/preview-mode-cookie-missing-from-non-local-environment/15527 "2024-03-21T00:20:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bone](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/bone/32/7151_2.png) [@bone](https://community.prismic.io/u/bone)\
**Post date:** [March 21, 2024, 12:20am UTC](https://community.prismic.io/t/preview-mode-cookie-missing-from-non-local-environment/15527/1 "2024-03-21T00:20:23Z")

</div>

Hi,  
I am working on getting the prismic preview toolbar working on a nextjs site I am working on. The preview toolbar is showing up fine when I run the site locally. However once I deploy it to Vercel and try to access the preview link from prismic, it does not show up in other environments…

Upon inspection the `io.prismic.preview` cookie is missing.

This is my code for `/api/preview`:

```auto
import { setPreviewData, redirectToPreviewURL } from '@prismicio/next';

import { createClient } from '../../prismicio';

export default async function handler(req, res) {
	const client = createClient({ req });

	await setPreviewData({ req, res });

	return await redirectToPreviewURL({ req, res, client });
}

```

---

<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 21, 2024, 1:57pm UTC](https://community.prismic.io/t/preview-mode-cookie-missing-from-non-local-environment/15527/3 "2024-03-21T13:57:08Z")

</div>

Hi @bone ,

Can you record an attempt to preview some content from Prismic in your browser using this plugin?

> **[Jam](https://chromewebstore.google.com/detail/jam/iohjgamcilhbgmhbnllfolmkmmekfmci)**
>
> The fastest bug reporting tool. Cut your bug reporting time by 20x.

It will help provide logs to debug this.

Thanks.

---

<div class="post-metadata">

**Author:** ![bone](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/bone/32/7151_2.png) [@bone](https://community.prismic.io/u/bone)\
**Post date:** [March 25, 2024, 12:57am UTC](https://community.prismic.io/t/preview-mode-cookie-missing-from-non-local-environment/15527/4 "2024-03-25T00:57:28Z")

</div>

I've recorded a video here:  
https://www.loom.com/embed/1b8b6d6d16d1469a95469a7fbadcca1d?sid=f7691d29-af7c-4d4a-93b6-169bd00094b2

I've attempted to preview from localhost then from staging with two different results.

Cheers,  
Pete

---

<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 25, 2024, 2:48pm UTC](https://community.prismic.io/t/preview-mode-cookie-missing-from-non-local-environment/15527/5 "2024-03-25T14:48:36Z")

</div>

In the video you've shown me, you were trying to preview a document with no draft content. I can't rule out that the deployed website (staging) isn't triggering the preview mode because the is no draft content to preview.

---

<div class="post-metadata">

**Author:** ![bone](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/bone/32/7151_2.png) [@bone](https://community.prismic.io/u/bone)\
**Post date:** [March 27, 2024, 10:44pm UTC](https://community.prismic.io/t/preview-mode-cookie-missing-from-non-local-environment/15527/6 "2024-03-27T22:44:45Z")

</div>

Hi Phil,

So I figured out the issue, it was on my side!

I use Brave browser and it was blocking the cookie, funnily enough I also tried on Chrome and forgot I had an extension that was also blocking cookies.

Cheers,  
Pete

---

<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 28, 2024, 9:22am UTC](https://community.prismic.io/t/preview-mode-cookie-missing-from-non-local-environment/15527/7 "2024-03-28T09:22:55Z")

</div>

I'm glad you were able to figure this out 🙂

For future readers this is also something listed in our preview troubleshooting guide:

> [@Troubleshooting: Content Previews](https://community.prismic.io/t/troubleshooting-previews/5449):
>
> This article is designed to help you troubleshoot Prismic Previews. NextJS If you're using Next.js make sure you have covered all the following setup steps. Install @prismicio/next to handle previews Add the [PrismicPreview](https://prismic.io/docs/setup-nextjs#add-prismicpreview) component to the root of your app [Configure the preview routes](https://prismic.io/docs/setup-nextjs#add-preview-routes)[Ensure your Prismic repository has the correct preview route](https://prismic.io/docs/setup-nextjs#configure-previews-in-your-prismic-repository)Other frameworks Have you added the Prismic preview toolbar script to your site? Check in the \<head\> or \<body\> of your pages to make sure the script …
