Skip to content

[BUG] ENOSPC: no space left on device, during bundling cache assets on cf worker infra #560

Open
@numdefined

Description

@numdefined

Describe the bug

When I try to build and deploy my opennext app on cloudflare, i'm hitting a disk space limit.

...
22:06:53.885 | ┌──────────────────────────────┐
-- | --
22:06:53.885 | │ OpenNext — Generating bundle │
22:06:53.885 | └──────────────────────────────┘
22:06:53.885 |  
22:06:53.902 | Bundling middleware function...
22:06:53.996 | Bundling static assets...
22:06:55.827 | Bundling cache assets...
22:06:58.750 | node:fs:3004
22:06:58.751 | binding.copyFile(
22:06:58.752 | ^
22:06:58.752 |  
22:06:58.752 | Error: ENOSPC: no space left on device, copyfile '/opt/buildhome/repo/.next/standalone/.next/server/app/cs/czechrepublic/party/TOP09/timeline.rsc' -> '/opt/buildhome/repo/.open-next/cache/hNKeabg4RyOjFviwV-RAi/cs/czechrepublic/party/TOP09/timeline.rsc'
-- | --
22:06:58.752 | at copyFileSync (node:fs:3004:11)
22:06:58.752 | at copyFile (node:internal/fs/cp/cp-sync:104:3)
22:06:58.752 | at onFile (node:internal/fs/cp/cp-sync:83:25)
22:06:58.752 | at getStats (node:internal/fs/cp/cp-sync:72:12)
22:06:58.752 | at copyDir (node:internal/fs/cp/cp-sync:170:9)
22:06:58.752 | at mkDirAndCopy (node:internal/fs/cp/cp-sync:145:3)
22:06:58.752 | at onDir (node:internal/fs/cp/cp-sync:139:25)
22:06:58.752 | at getStats (node:internal/fs/cp/cp-sync:68:12)
22:06:58.752 | at copyDir (node:internal/fs/cp/cp-sync:170:9)
22:06:58.752 | at mkDirAndCopy (node:internal/fs/cp/cp-sync:145:3) {
22:06:58.752 | errno: -28,
22:06:58.752 | code: 'ENOSPC',
22:06:58.752 | syscall: 'copyfile',
22:06:58.752 | path: '/opt/buildhome/repo/.next/standalone/.next/server/app/cs/czechrepublic/party/TOP09/timeline.rsc',
22:06:58.752 | dest: '/opt/buildhome/repo/.open-next/cache/hNKeabg4RyOjFviwV-RAi/cs/czechrepublic/party/TOP09/timeline.rsc'
22:06:58.753 | }
22:06:58.753 |  
22:06:58.753 | Node.js v22.9.0
...

I've asked in the opennext discord and they said:

Open an issue in the cloudflare repo, it should not copy .rsc file

Steps to reproduce

  1. have open-next.config.ts using staticAssetsIncrementalCache as incrementalCache
  2. have app with tons of static routes (using generateStaticParams, Generating static pages (7553/7553))

I can also send someone a reproduction if needed. It's not open source yet.

Expected behavior

It probably shouldn't use copyFile but rename instead as it won't create copies on disk which might be unwanted for the cf build infrastructure

@opennextjs/cloudflare version

1.0.0-beta.2

Wrangler version

4.9.1

next info output

Binaries:
  Node: 20.18.2
  npm: 10.8.2
  Yarn: 1.22.19
  pnpm: 10.1.0
Relevant Packages:
  next: 15.2.5 // There is a newer version (15.3.0) available, upgrade recommended! 
  eslint-config-next: 15.2.5
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.8.3
Next.js Config:
  output: N/A
 ⚠ There is a newer version (15.3.0) available, upgrade 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

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