You would get the same error locally by building it with next build
.
Route Handlers have a different signature with App Router, see the official docs. If you rely on your response, try awaiting it from the request as follows:
export const POST = async (req: NextRequest) => {
const data = await req.json();
const { params } = await data as MyResponse;
if (!params || !params.action)
return NextResponse.json({ success: false, message: "Incorrect usage" });
const action = params.action;
...
};