Changes in Prismic not appearing on my website

Hi,

I am developing a website with nextjs, the changes in prismic show up immediately on localhost but do not show up on my hosted website on Vercel.

I am using a webhook to redeploy my website when there is a change in a document and the webhook seems to be working fine, it returns an 201 and triggers a deployment on vercel. The problem is that the changes I make do not make it to Vercel, so let's say for example when I publish a new document, it show up in my localhost, it triggers a deploy on Vercel but after the deploy is done on Vercel the document is still not there. Is there something I'm missing?

And yes I have looked at the FAQ article about it.

Hi @thorbergur ,

If you are seeing the changes locally that suggests the project is consuming the API correctly.

Can you try viewing the website in incognito mode?
Are you caching your master ref?

It is the same in incognito, also tried different devices and browsers that have never accessed the site before.

I am not sure where I check the caching of my master ref? I have tried to purge the cache in Vercel and that got me nowhere

Are you using the pages or the app directory in your Next.js project.

I'm using the app directory

Do you know how long you've set ISR to rebuild after each validation?

OK, I got some help from the experts and it seems you are rebuilding your whole site whenever content changes, but not invalidating the Next.js fetch() cache. As a result, all network requests will continue returning stale data.

Rather than rebuild your whole site when content changes, you should be clearing the fetch() cache using on-demand revalidation.

The “Set up on-demand revalidation” section of this blog post explains how to set it up:

I followed the tutorial and by the looks of it I had everything configured correctly, I did not have the webhook tho, now I created the webhook, it is returning 405 error, any idea what could be causing that?

405 means the method isn't allowed - ie: the type of request isn't allowed (GET,POST etc).

The revalidate route via Prismic webhooks requires a POST and it looks like Prismic sends a payload along with the request as well.

If you use anything but a POST to request the script you'll get a 405 instead.

So start with how your calling the revalidate script if its via the Prosmic webhook... that should work fine.

It is indeed the prismic webhook that is returning the 405 error

Here is the code in my revalidate route

The revalidate endpoint works in postman when I try to post the data from the test-trigger directly in postman...

I see the error now, I am missing the /api/ in my route :face_with_peeking_eye:

2 Likes