Skip to content

[BUG] Static chunks for dynamic App Router routes using %255B fail with 404 in Cloudflare Worker #772

Open
@RahavLussato

Description

@RahavLussato

Describe the bug

I'm using [email protected] with App Router and deploying to Cloudflare Workers using @open-next/cloudflare (following the official guide). When I have a dynamic route like [entityId], Next.js generates static chunks with double-encoded filenames, e.g.:
/_next/static/chunks/app/dashboard/creator/%255BentityId%255D/page-xxx.js

But at runtime, that request fails with a 404. It looks like the Cloudflare Worker decodes %255B to %5B, so it looks for:
/_next/static/chunks/app/dashboard/creator/%5BentityId%5D/page-xxx.js

—which doesn’t exist.

Confirmed:

  • Works in Next.js 14.2.5 (which doesn’t use double-encoded paths)
  • The file exists in .open-next/assets/... with %255B in the name
  • Only one request is made (not a fallback issue)

Steps to reproduce

  1. Create a new Next.js app with [email protected] using the App Router.
  2. Add a dynamic route like: app/dashboard/entity/[entityId]/page.tsx
  3. Deploy the app to Cloudflare Workers using open-next following: https://opennext.js.org/cloudflare/get-started
  4. Visit any route that matches the dynamic path, e.g.: https://yourdomain.com/dashboard/creator/123
  5. Open DevTools → Network tab, and observe:
  • The browser requests a static chunk like:
    /static/chunks/app/dashboard/creator/%255BcreatorId%255D/page-xxxxx.js

  • The request fails with 404

  1. Check .open-next/assets/_next/static/chunks/app/... and verify that the file does exist using the double-encoded name.

Expected behavior

The Worker should preserve the raw encoded path when matching static chunk files, to support dynamic route segments in Next.js 15.

@opennextjs/cloudflare version

1.4.0

Wrangler version

4.24

next info output

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:49 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 10
Binaries:
  Node: 20.18.0
  npm: 10.8.2
  Yarn: 1.22.19
  pnpm: 9.12.1
Relevant Packages:
  next: 15.3.4 // There is a newer version (15.3.5) available, upgrade recommended! 
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.8.3
Next.js Config:
  output: N/A
 ⚠ There is a newer version (15.3.5) available, upgrade recommended!

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions