# Preview mode hangs/timing out (preview token expires?)

**URL:** <https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491>\
**Category:** Developing with Prismic\
**Tags:** javascript\
**Created:** [January 8, 2021, 8:56pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491 "2021-01-08T20:56:05Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![allaire](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/allaire/32/1501_2.png) [@allaire](https://community.prismic.io/u/allaire)\
**Post date:** [January 8, 2021, 8:56pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/1 "2021-01-08T20:56:06Z")

</div>

Good day,

We have a known issue with Prismic's preview that we can't wrap our head around.

I've opened an issue here: [Preview mode timing out (UnhandledPromiseRejectionWarning) · Issue #132 · prismicio/prismic-client · GitHub](https://github.com/prismicio/prismic-javascript/issues/132) — Alas no solution so far.

I'm not sure if this is a JS (frontend) or Node (backend) problem (we use Express), but it seems that when a preview token expires (let say I was in preview mode and comeback a week later on our website), the site hangs indefinitely. The solution so far is to ask my team to clear the "Application data" in Chrome, which I think clear the expired preview token.

In the GitHub issue I pasted all the code related to this, let me know if you need anything else on my end.

Here's the error report in Sentry:

 ![Annotation 2021-01-08 at 15.53.31@2x](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/f/f50f2cc9fdce630eb0bbbde079a113699a0655a9.png)

Thank you!

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [January 12, 2021, 1:43pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/4 "2021-01-12T13:43:43Z")

</div>

Hey @allaire,

Welcome to the Prismic Community Forum. Thanks for posting this question. I've submitted a request to our dev team to look into it. I'll let you know what happens next.

Sam

---

<div class="post-metadata">

**Author:** ![allaire](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/allaire/32/1501_2.png) [@allaire](https://community.prismic.io/u/allaire)\
**Post date:** [January 19, 2021, 2:39pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/6 "2021-01-19T14:39:25Z")

</div>

Any update @samlittlefair ?

Thank you

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [January 19, 2021, 3:43pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/7 "2021-01-19T15:43:03Z")

</div>

Hey @allaire,

Thanks for checking in. I've spoken to our dev team about this, and they're looking into it. If I don't hear anything back from them this week, I'll follow up on Monday and let you know what they say 🙂

Sam

---

<div class="post-metadata">

**Author:** ![allaire](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/allaire/32/1501_2.png) [@allaire](https://community.prismic.io/u/allaire)\
**Post date:** [February 10, 2021, 1:51pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/8 "2021-02-10T13:51:47Z")

</div>

Good day. This issue is still causing trouble to my team and as a paying user, I'm disappointed by the lack of support this is receiving. I'm willing to share whatever is missing to help you debug this.

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [February 10, 2021, 2:30pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/9 "2021-02-10T14:30:46Z")

</div>

Hi @allaire ,

Sorry for the silence on my end. I've been going back and forth with the dev team on this.

Can you explain a little more about the context of the issue, so I understand better?

Usually, a user would launch a preview from the editor, and close that preview when they're done. A week later, they might launch another preview from the editor. It sounds like you're describing a different workflow. Can you clarify for me?

Sam

---

<div class="post-metadata">

**Author:** ![allaire](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/allaire/32/1501_2.png) [@allaire](https://community.prismic.io/u/allaire)\
**Post date:** [February 10, 2021, 3:41pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/10 "2021-02-10T15:41:43Z")

</div>

An editor launch a preview, then start editing while previewing in real time. He never presses the "X" in the widget at the bottom. He might (or not) publish the article he was previewing at some point. The editor's browser is never closed (so the preview session cookie isn't cleared). At some point, when the editor tries to access the site again (this could be a couple days later), the site hangs and returns the error highlighted in my post. It looks like the preview token is expired and the error is never caught by Prismic, so the site just hangs. The workaround is to wait for NGINX to timeout, then go in "Application Data" and clear all website's cookies.

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [February 10, 2021, 4:44pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/11 "2021-02-10T16:44:39Z")

</div>

@allaire Thanks for the clarification. And what's your tech stack?

---

<div class="post-metadata">

**Author:** ![allaire](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/allaire/32/1501_2.png) [@allaire](https://community.prismic.io/u/allaire)\
**Post date:** [February 10, 2021, 4:57pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/12 "2021-02-10T16:57:23Z")

</div>

Simple Node + Express stack, more here: [Preview mode timing out (UnhandledPromiseRejectionWarning) · Issue #132 · prismicio/prismic-javascript · GitHub](https://github.com/prismicio/prismic-javascript/issues/132)

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [February 10, 2021, 5:13pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/13 "2021-02-10T17:13:51Z")

</div>

@allaire Thank you for the extra info! I've gone back to my dev team with it, and I'll let you know what I hear back. I'm out of the office on Friday, but we've got a sync scheduled for Monday, so I'll check on the progress then and get back to you the same day.

Sam

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [February 15, 2021, 4:57pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/14 "2021-02-15T16:57:10Z")

</div>

Hey @allaire, Just an update that I don't have any more info yet, but I'll be sure to let you know tomorrow.

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [February 16, 2021, 4:46pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/15 "2021-02-16T16:46:36Z")

</div>

Hey @allaire ,

I've talked to the dev team about this, and they've added the issue to their tracker. I can't say when they'll address it, but I'll let you know if there's any movement! In the meantime, let me know if you want to talk about other ideas for workarounds.

Best,  
Sam

---

<div class="post-metadata">

**Author:** ![allaire](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/allaire/32/1501_2.png) [@allaire](https://community.prismic.io/u/allaire)\
**Post date:** [February 16, 2021, 5:24pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/16 "2021-02-16T17:24:59Z")

</div>

Thanks Sam, let's follow up in a couple months 😉

Have a good day!

Math

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [February 17, 2021, 8:48am UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/17 "2021-02-17T08:48:31Z")

</div>

We're tracking this issue.

---

<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, 5:24pm UTC](https://community.prismic.io/t/preview-mode-hangs-timing-out-preview-token-expires/3491/18 "2021-12-09T17:24:53Z")

</div>


