OpenNext worker apis not working properly in deployed environment

Hello, I have an OpenNext worker, with an api route /api/subscribe. Here is the endpoint:
import { NextResponse } from "next/server"
import { getCloudflareContext } from "@opennextjs/cloudflare";

export async function POST(req: Request) {
  try {
    console.log("POST /api/subscribe");
    console.log("req", req);


    return NextResponse.json({ success: true })
  } catch (error) {
    console.error("Subscription error:", error)
    return NextResponse.json({ error: "Failed to process subscription" }, { status: 500 })
  }
}

The problem is on local environment everything is fine and the logs are :
POST /api/subscribe
req Request {
  method: 'POST',
  url: 'http://localhost:3000/api/subscribe',
  headers: Headers {
    host: 'localhost:3000',
    connection: 'keep-alive',
    'content-length': '25',
    'sec-ch-ua-platform': '"Windows"',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36',
    'sec-ch-ua': '"Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"',
    'content-type': 'application/json',
    'sec-ch-ua-mobile': '?0',
    accept: '*/*',
    origin: 'http://localhost:3000',
    'sec-fetch-site': 'same-origin',
    'sec-fetch-mode': 'cors',
    'sec-fetch-dest': 'empty',
    referer: 'http://localhost:3000/',
    ......
  },
  destination: '',
  referrer: 'about:client',
  referrerPolicy: '',
  mode: 'cors',
  credentials: 'same-origin',
  cache: 'default',
  redirect: 'follow',
  integrity: '',
  keepalive: false,
  isReloadNavigation: false,
  isHistoryNavigation: false,
  signal: AbortSignal { aborted: false }
}

but the deployed version receives empty request:
POST https://caster-fun.kaspiummage.workers.dev/api/subscribe - Ok @ 3/11/2025, 12:48:57 AM
  (log) POST /api/subscribe
  (log) req {}

you can see the structure in the picture.
I had another api with the same problem, am I doing something wrong?
image.png
Was this page helpful?