Skip to content

[BUG] Failed to set to read-only cache for SSG site #831

@Dramelac

Description

@Dramelac

Describe the bug

I have an SSG Next.js site hosted on Cloudflare worker. The site works fine but it is not using cache.

I tried to use the static cache as explained here: https://opennext.js.org/cloudflare/caching#ssg-site but on each invocation I have an error log with message:"Failed to set to read-only cache".

Did I miss something ?

Steps to reproduce

On open-next.config.ts I have:

import { defineCloudflareConfig } from "@opennextjs/cloudflare";
import staticAssetsIncrementalCache from "@opennextjs/cloudflare/overrides/incremental-cache/static-assets-incremental-cache";

export default defineCloudflareConfig({
  incrementalCache: staticAssetsIncrementalCache,
  enableCacheInterception: true,
});

On my wrangler config I have:

  • A worker self reference:
"services": [
  {
    "binding": "WORKER_SELF_REFERENCE",
    "service": "site-dev"
  }
]
  • I have a reference to assets
"assets": {
    "directory": ".open-next/assets",
    "binding": "ASSETS"
  }
  • I'm not sure if this is needed for SSG cache (doc is not very precise about SSG caching) but I tried to create and bind an R2 cache bucket but it didn't change anything:
"r2_buckets": [
  {
    "binding": "NEXT_INC_CACHE_R2_BUCKET",
    "bucket_name": "dev-cache-web-dashboard"
  }
]

I also have enabled logs to see the error message but there isn't any details on why the cache failed.

Expected behavior

The site works as intended using cache without error log.

@opennextjs/cloudflare version

1.6.2

Wrangler version

4.26.0

next info output

My application is deployed with cloudflare build.

Relevant Packages:
  next: 15.3.5 // There is a newer version (15.4.5) available, upgrade recommended!
  eslint-config-next: 15.2.4
  react: 19.1.1
  react-dom: 19.1.1
  typescript: 5.8.3
Next.js Config:
  output: N/A

Additional context

Thank you for the help!

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