# Error fetching content "The provided ref is no longer accessible"

**URL:** <https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155>\
**Category:** Developing with Prismic\
**Tags:** nextjs\
**Created:** [September 22, 2023, 2:26pm UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155 "2023-09-22T14:26:23Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![alain00.alvarez](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/alain00.alvarez/32/6319_2.png) [@alain00.alvarez](https://community.prismic.io/u/alain00.alvarez)\
**Post date:** [September 22, 2023, 2:26pm UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/1 "2023-09-22T14:26:23Z")

</div>

Hi, I'm having this error while fetching documents using a permanent access token, If I generate a new token the fetch works fine

```auto
response: {
    type: 'api_validation_error',
    message: 'The provided ref is no longer accessible, it has expired. Master ref is: ZQsdphAAACEA2FjG'
  }

```

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [September 25, 2023, 10:20am UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/3 "2023-09-25T10:20:45Z")

</div>

Thanks for sharing your use case @alain00.alvarez.

Indeed, each time you get this type of error, you should use a valid and up-to-date ref when fetching documents using a permanent access token.

---

<div class="post-metadata">

**Author:** ![jon1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jon1/32/4800_2.png) [@jon1](https://community.prismic.io/u/jon1)\
**Post date:** [October 6, 2023, 1:27pm UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/4 "2023-10-06T13:27:27Z")

</div>

Hi,

I am having this exact issue, what exactly is causing this to occur? It actually took me a while to figure out what token was incorrect. Building my site locally works fine, but as soon as it is deployed to Vercel I get the error message?

Thanks

---

<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:** [October 6, 2023, 3:26pm UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/8 "2023-10-06T15:26:45Z")

</div>

Hey everyone,

We're looking into some issues around caching in Next.js. @alain00.alvarez and @jon1 are you both using the App Router?

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:** [October 6, 2023, 3:27pm UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/9 "2023-10-06T15:27:49Z")

</div>

In the meantime, you can see if there's any helpful information here:

> [@Caching issue with Next.js App Router - Vercel Deployment](https://community.prismic.io/t/caching-issue-with-next-js-app-router-vercel-deployment/13834):
>
> Dear Prismic team I set up a new Next.js App Router project using your setup command npx @slicemachine/init@latest and walking trough your step by step setup guide. In previous versions, I never had issues deploying the site to Vercel and setting up Prismic Webhooks to trigger redeploys. With this new project it seems like there are some caching issues with Vercel: If I push a new commit to Github or if I edit content on Prismic, it triggers a new deploy correctly. Unfortunately those deplo…

---

<div class="post-metadata">

**Author:** ![jon1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jon1/32/4800_2.png) [@jon1](https://community.prismic.io/u/jon1)\
**Post date:** [October 7, 2023, 5:43am UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/10 "2023-10-07T05:43:05Z")

</div>

Hi @samlittlefair, I am using the app router yes. Thanks for the link to this topic!

---

<div class="post-metadata">

**Author:** ![ngiusti](https://avatars.discourse-cdn.com/v4/letter/n/c67d28/32.png) [@ngiusti](https://community.prismic.io/u/ngiusti)\
**Post date:** [October 16, 2023, 7:19pm UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/11 "2023-10-16T19:19:49Z")

</div>

Hey, I am also having this issue with Nuxt and Vue when deploying on netlify. Is there any update to this issue?

---

<div class="post-metadata">

**Author:** ![nf\_mastroianni](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/nf_mastroianni/32/7071_2.png) [@nf\_mastroianni](https://community.prismic.io/u/nf_mastroianni)\
**Post date:** [October 16, 2023, 10:27pm UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/12 "2023-10-16T22:27:02Z")

</div>

I feel like I was getting this issue among other strange cache issues. Adding the following to my package.json build script helped with Vercel build issues. Locally, I just nuked the .next folder entirely and ran a build and no issues:

```auto
"build": "rm -rf .next/cache/fetch-cache && next build"

```

Anyone else want to test 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:** [October 17, 2023, 9:39am UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/13 "2023-10-17T09:39:04Z")

</div>

@ngiusti If you're having this issue on Nuxt and Vue, it might be a separate error. Could you open a new thread and post your error message?

---

<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:** [October 17, 2023, 9:39am UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/14 "2023-10-17T09:39:35Z")

</div>

Hey everyone,

We have opened a thread on the Next.js GitHub repository. Feel free to upvote and subscribe to follow along:

> **[Inconsistent caching with \`revalidateTag()\` and Vercel Data Cache ·...](https://github.com/vercel/next.js/discussions/56822)**
>
> Hi Vercel team, I’m Angelo from Prismic. I maintain Prismic’s Next.js integration. We and our customers are having trouble with the App Router’s fetch() cache. We are hoping we could get some help ...

Sam

---

<div class="post-metadata">

**Author:** ![jerry.nummi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jerry.nummi/32/197_2.png) [@jerry.nummi](https://community.prismic.io/u/jerry.nummi)\
**Post date:** [April 22, 2024, 4:10pm UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/16 "2024-04-22T16:10:09Z")

</div>

Is anyone else still experiencing this? I'm running Next `14.1.3`

---

<div class="post-metadata">

**Author:** ![nf\_mastroianni](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/nf_mastroianni/32/7071_2.png) [@nf\_mastroianni](https://community.prismic.io/u/nf_mastroianni)\
**Post date:** [April 22, 2024, 4:20pm UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/17 "2024-04-22T16:20:39Z")

</div>

On occasion I see some “stranger things” related to refs. I just delete my .next folder locally and the issue goes away. Fortunately, I haven’t seen this issue in production in a while though.

---

<div class="post-metadata">

**Author:** ![jerry.nummi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jerry.nummi/32/197_2.png) [@jerry.nummi](https://community.prismic.io/u/jerry.nummi)\
**Post date:** [April 22, 2024, 4:50pm UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/18 "2024-04-22T16:50:58Z")

</div>

Strange. I have it in Production but not locally.

---

<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:** [April 23, 2024, 10:19am UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/19 "2024-04-23T10:19:11Z")

</div>

Yes, this issue is mostly occurring in Vercel deployments. The following thread has some suggested fixes:

> [@Caching issue with Next.js App Router - Vercel Deployment](https://community.prismic.io/t/caching-issue-with-next-js-app-router-vercel-deployment/13834):
>
> Dear Prismic team I set up a new Next.js App Router project using your setup command npx @slicemachine/init@latest and walking trough your step by step setup guide. In previous versions, I never had issues deploying the site to Vercel and setting up Prismic Webhooks to trigger redeploys. With this new project it seems like there are some caching issues with Vercel: If I push a new commit to Github or if I edit content on Prismic, it triggers a new deploy correctly. Unfortunately those deplo…

---

<div class="post-metadata">

**Author:** ![nicolecrst](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/nicolecrst/32/7458_2.png) [@nicolecrst](https://community.prismic.io/u/nicolecrst)\
**Post date:** [May 28, 2024, 3:00pm UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/21 "2024-05-28T15:00:59Z")

</div>

Good afternoon, my Teach Lead and I managed to solve this problem in nextjs 14.2 using react's "cache" function. For now it is working well in our projects. 🤠

```auto
import { createClient } from '@prismicio/client'
import sm from '../../slicemachine.config.json'

export const client = createClient(
  `https://${sm.repositoryName}.cdn.prismic.io/api/v2`,
)

export const getTimeline = cache(async () => {
  return await client.getSingle('timeline')
})

```

---

<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:** [May 29, 2024, 10:55am UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/22 "2024-05-29T10:55:47Z")

</div>

Thank you for sharing your solution Nicole 🙂 Although I'm curious as to what happens when you update the 'timeline' type? Can you test this and see if it works correctly?

And welcome to the community!

---

<div class="post-metadata">

**Author:** ![nicolecrst](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/nicolecrst/32/7458_2.png) [@nicolecrst](https://community.prismic.io/u/nicolecrst)\
**Post date:** [June 3, 2024, 12:35pm UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/23 "2024-06-03T12:35:45Z")

</div>

good morning! I went back to work on the project and got the "Unhandled Runtime Error Error: No documents were returned" error again, I deleted the .next cache folder and it corrected my error, I believe it is due to cache and conflict with other projects, informing which worked normally even without the react cache function after deleting the folder

---

<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:** [June 4, 2024, 11:58am UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/24 "2024-06-04T11:58:51Z")

</div>

I thought this might be an issue, and this is why we don't recommend using a cache with Prismic, especially for the main/master ref.

---

<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:** [September 9, 2024, 10:44am UTC](https://community.prismic.io/t/error-fetching-content-the-provided-ref-is-no-longer-accessible/14155/25 "2024-09-09T10:44:22Z")

</div>

A post was merged into an existing topic: [Next.js Vercel revalidation error](https://community.prismic.io/t/next-js-vercel-revalidation-error/16634/5)
