Skip to content

[BUG] Can't make On-Demand revalidation work #1052

@grabmateusz

Description

@grabmateusz

Describe the bug

It seems On-Demand revalidation does not work while having Next.js project deployed to Cloudflare using OpenNext Cloudflare adapter. Self-hosted project works fine.

Steps to reproduce

I've created repository where issue is reproducible:
https://github.com/grabmateusz/isr-on-demant-revalidate-issue/tree/main
If you build the project and run via:

npm run build
npm run start

you can visit:
http://localhost:3000/ssr
And you will see cached timestamp from the API call and SSR'ed current server time.
If you visit:
http://localhost:3000/isr
You will see cached timestamp from the API call and ISR'ed server time, revalidated each minute.

There are 2 endpoints to invalidate cache:
POST http://localhost:3000/api/revalidate-data-cache
and
POST http://localhost:3000/api/revalidate-isr-cache

First one will invalidate data cache by calling:

revalidateTag("data-cache");

so will take effect on both routes immediately.
Second one will call:

revalidatePath("/isr", "page");

And will affect only /isr route.

Everything works as I want while self-hosting this.
Unfortunately after deploying this to Cloudflare via OpenNext Cloudflare Adapter both revalidate endpoints are not working.

Whenever I visit /isr route I have response with header:
``
x-opennext-cache: HIT

when TTL is reached I have:

x-opennext-cache: STALE

and then when revalidation is done I have:

x-opennext-cache: HIT

open-next.config.ts for reference:
https://github.com/grabmateusz/isr-on-demant-revalidate-issue/blob/main/open-next.config.ts

### Expected behavior

On-Demand revalidation should trigger invalidation and when it's completer route that is a subject of ISR should perform SSR and return up-to-date data with header:

x-opennext-cache: MISS


### @opennextjs/cloudflare version

1.14.4

### Wrangler version

4.56.0

### next info output

```shell
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 10
Binaries:
  Node: 20.19.2
  npm: 10.8.2
  Yarn: 1.22.21
  pnpm: 10.15.0
Relevant Packages:
  next: 15.5.9 // An outdated version detected (latest is 16.1.0), upgrade is highly recommended!
  eslint-config-next: 15.4.6
  react: 19.1.4
  react-dom: 19.1.4
  typescript: 5.9.3
Next.js Config:
  output: N/A
 ⚠ An outdated version detected (latest is 16.1.0), upgrade is highly recommended!
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue

Additional context

Shared by me project is a showcase, issue affects much bigger project, where we use self-hosted Next.js project, on-demand revalidation is a fundamental feature and lack of it is blocking migration from self-hosted Next.js to OpenNext Cloudflare Adapter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions