Skip to content

[BUG] FormData sent via Service Binding is serialized as text/plain in local development #1031

@xiandew

Description

@xiandew

Describe the bug

When sending a FormData object (containing a File) from a Next.js app (using @opennextjs/cloudflare) to another Worker via a Service Binding, the request body is received as text/plain instead of multipart/form-data.

This appears to happen in the local Node.js environment (using next dev).

Steps to reproduce

Minimal reproduction link: https://github.com/xiandew/opennext-binding-repro

  1. Clone the reproduction repository.
  2. Install dependencies: pnpm install.
  3. Start the backend worker: cd apps/backend && pnpm dev.
  4. Start the frontend: cd apps/frontend && pnpm run dev.
  5. Click the "Trigger Upload" button on the frontend.
  6. Observe the logs in the backend terminal.

Expected behavior

The backend worker should receive a request with Content-Type: multipart/form-data; boundary=... and be able to parse the FormData.

Actual Behavior:
The backend worker receives a request with Content-Type: text/plain;charset=UTF-8.
The body contains the string representation of the file/data rather than the proper multipart binary stream.

@opennextjs/cloudflare version

1.14.3

Wrangler version

4.53.0

next info output

frontend % npx next info                              

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.1.0: Mon Oct 20 19:33:36 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6030
  Available memory (MB): 36864
  Available CPU cores: 12
Binaries:
  Node: 22.3.0
  npm: 10.8.1
  Yarn: 1.22.22
  pnpm: 10.8.0
Relevant Packages:
  next: 15.5.7 // An outdated version detected (latest is 16.0.7), upgrade is highly recommended!
  eslint-config-next: 15.0.3
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.9.3
Next.js Config:
  output: N/A
 ⚠ An outdated version detected (latest is 16.0.7), upgrade is highly 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