# Nextjs caching issues, users seeing old content returned from prismic api

**URL:** <https://community.prismic.io/t/nextjs-caching-issues-users-seeing-old-content-returned-from-prismic-api/15900>\
**Category:** Developing with Prismic\
**Tags:** nextjs\
**Created:** [May 10, 2024, 8:34pm UTC](https://community.prismic.io/t/nextjs-caching-issues-users-seeing-old-content-returned-from-prismic-api/15900 "2024-05-10T20:34:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![research-admin](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@research-admin](https://community.prismic.io/u/research-admin)\
**Post date:** [May 10, 2024, 8:34pm UTC](https://community.prismic.io/t/nextjs-caching-issues-users-seeing-old-content-returned-from-prismic-api/15900/1 "2024-05-10T20:34:27Z")

</div>

### Impacted feature

The homepage of the website shows the 10 most recently added articles. Some of our users are not seeing the updated content after it is published on Prismic, but the content appears if they visit the website in incognito mode.

Our website is built with the Nextjs pages router and uses the deploy hook integration with Vercel to trigger a new build

### What steps have you taken to resolve this issue already?

We looked at some suggestions in this [thread](https://community.prismic.io/t/caching-issue-with-next-js-app-router-vercel-deployment/13834/41), but most of them use the app router so I'm not sure how much they apply to our website still using the pages router

Tried the following steps but none of them worked

- added `cache: 'no-cache',` to `fetchOptions` when calling `prismic.createClient` in `prismisc.ts`:

```auto
  const client = prismic.createClient(repositoryName, {
    ...config,
    fetchOptions: {
      cache: 'no-cache',
      ...(config.fetchOptions ?? {})
    }
  })

```

- set `VERCEL_FORCE_NO_BUILD_CACHE=1`
- Updated Next version from 13.4.9 to 14.2.3

### Hosting provider

Vercel

I can provide .har files with examples of a request on the homepage showing stale content and one showing the updated content if that helps with debugging.

Is there anything you suggest that can help with this intermittent caching issue?

---

<div class="post-metadata">

**Author:** ![Christopotamus](https://avatars.discourse-cdn.com/v4/letter/c/c67d28/32.png) [@Christopotamus](https://community.prismic.io/u/Christopotamus)\
**Post date:** [May 10, 2024, 9:46pm UTC](https://community.prismic.io/t/nextjs-caching-issues-users-seeing-old-content-returned-from-prismic-api/15900/2 "2024-05-10T21:46:31Z")

</div>

The prismic client would normally only be used/initialized during the build itself, so those fetchOptions would only affect the static site generation. With pages router this is normally done via [getStaticProps](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-static-props) which only runs on the server and never on the client.

> [@research-admin](#):
>
> Some of our users are not seeing the updated content after it is published on Prismic, but the content appears if they visit the website in incognito mode.

This part makes me think the issue is not with prismic or even the next.js build process, but something on the Vercel side (cache control headers maybe) or their browser is aggressively caching things for some reason.

If it **always** loads correctly incognito then I would assume there is nothing wrong with your prismic client config / next build process and start looking towards browser cache.

You may want to read the caching documentation page

> **[Caching on Vercel's Edge Network](https://vercel.com/docs/edge-network/caching#cache-control-options)**
>
> Vercel's Edge Network caches your content at the edge in order to serve data to your users as fast as possible. Learn how Vercel caches works in this guide.

Do you know if they _eventually_ see the updated posts using normal refresh?
