Payload seems to refuse to serve response to a request during revalidation of Next.js app

default discord avatar
4 months ago


I have a monorepo setup with Payload and Next.js.

I use a


router in Next.js, and I use on demand static revalidation. The static revalidation works, until to a point, where it seems Payload refuses to serve a meaningful JSON response to my Next.js application during the revalidation phase (therefore the revalidation crashes).

When I change content in Payload CMS, and I save it once, the revalidation works. If I save it twice, three four times it still works.

However, when I want to save the content on like a 10th try or a certain amount of seconds after the first save, revalidation error is thrown as the fetch from Next.js to Payload CMS doesn't return a JSON content as it should.

Ok, it seems like I solved it. Both Payload CMS and Next.js are behind a Traefik (half proxy). I thought it can be a rate limiting problem and it was! In according to Payload documentation I implemented this into configuration and now every request to Payload during revalidation returns an OK JSON response. Now even a huge amount of revalidation requests (1 revalidation every second) finish correctly.

rateLimit: {
    trustProxy: true,
    max: 5000,
    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!


    Connect with the Payload Community on Discord



    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.