Skip to content

Next.js 16: file uploads via Server Actions lose file on first call when using proxy.ts (dev only; mp3/mp4) #85348

@nghiepdev

Description

@nghiepdev

Link to the code that reproduces this issue

https://github.com/nghiepdev/next16-server-action-proxy-uploadfile-mp34-bug

To Reproduce

  1. Run next dev.
  2. Select a file.
  3. Click Upload.
  4. Check the terminal — the file is missing on the first attempt.
  5. Click Upload again.
  6. The terminal now logs the file.

Current vs. Expected behavior

In development mode, when ‎proxy.ts is configured, the first call to a server action that uploads an mp3/mp4 results in the uploaded file being missing or empty. Subsequent calls work. Image uploads do not exhibit this problem.

Expected: All file types (including mp3/mp4) should be consistently available to server actions on the first call in development, regardless of proxy configuration.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:50 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6030
  Available memory (MB): 36864
  Available CPU cores: 12
Binaries:
  Node: 24.10.0
  npm: 11.6.1
  Yarn: N/A
  pnpm: 10.18.0
Relevant Packages:
  next: 16.0.0 // Latest available version is detected (16.0.0).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Server Actions, Middleware

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

Problem occurs only in development. If I remove proxy.ts, the bug no longer appears.
Also, the issue does not occur with JPEG files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    MiddlewareRelated to Next.js Middleware.Server ActionsRelated to Server Actions.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions