Skip to content

[BUG] TS failure in built bucket-cache-purge.js file with worker-types #1204

@hitsthings

Description

@hitsthings

Describe the bug

Running wrangler types --env-interface CloudflareEnv types/cloudflare-env.d.ts creates the *.d.ts which includes

export abstract class DurableObject<Env = Cloudflare.Env, Props = {}> implements Rpc.DurableObjectBranded {
        [Rpc.__DURABLE_OBJECT_BRAND]: never;
        protected ctx: DurableObjectState<Props>;
        protected env: Env;
        ...

Building the OpenNextJS code creates /.open-next/.build/durable-objects/bucket-cache-purge.js which includes

// node_modules/@opennextjs/cloudflare/dist/api/durable-objects/bucket-cache-purge.js
var DEFAULT_BUFFER_TIME_IN_SECONDS = 5;
var MAX_NUMBER_OF_TAGS_PER_PURGE = 100;
var BucketCachePurge = class extends DurableObject {

The build fails because of

.open-next/.build/durable-objects/bucket-cache-purge.js:116:5
Type error: Property 'ctx' of exported anonymous class type may not be private or protected.

  114 | var DEFAULT_BUFFER_TIME_IN_SECONDS = 5;
  115 | var MAX_NUMBER_OF_TAGS_PER_PURGE = 100;
> 116 | var BucketCachePurge = class extends DurableObject {
      |     ^
  117 |   bufferTimeInSeconds;
  118 |   constructor(state, env) {
  119 |     super(state, env);
Next.js build worker exited with code: 1 and signal: null

Steps to reproduce

  1. Generate types: wrangler types --env-interface CloudflareEnv types/cloudflare-env.d.ts
  2. Run opennextjs-cloudflare build

Expected behavior

Build succeeds.

@opennextjs/cloudflare version

1.19.1

Wrangler version

4.83.0

next info output

> @releasedsoftware/portal@0.1.0 next
> next info

warn  - Failed to fetch latest canary version. (Reason: Failed to get registry from "yarn"..)
      Detected "15.2.8". Visit https://github.com/vercel/next.js/releases.
      Make sure to try the latest canary version (eg.: `npm install next@canary`) to confirm the issue still exists before creating a new issue.

Learn more: https://nextjs.org/docs/messages/opening-an-issue

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.1.0: Mon Oct 20 19:33:00 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6020
  Available memory (MB): 32768
  Available CPU cores: 12
Binaries:
  Node: 24.11.1
  npm: 11.0.0
  Yarn: 4.0.2
  pnpm: 10.14.0
Relevant Packages:
  next: 15.2.8
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.2
Next.js Config:
  output: N/A

Additional context

No response

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