Next.js Discord

Discord Forum

Server action is running on client-side on Vercel deployment

Unanswered
teo.villanueva posted this in #help-forum
Open in Discord
For some weird reason my server action is being run on the client-side. This only happens on the vercel deployment

This is the code for the action

"use server";

import { prisma } from "@/lib/prisma";

export async function addPlayersToGame({
  gameId,
  playerIds,
}: {
  gameId: string;
  playerIds: string[];
}) {
  return prisma.game.update({
    where: { id: gameId },
    data: {
      players: { connect: playerIds.map((id) => ({ id })) },
    },
  });
}


Im getting this error from prisma

PrismaClient is unable to run in this browser environment, or has been bundled for the browser (running in `unknown`). If this is unexpected, please open an issue: https://pris.ly/prisma-prisma-bug-report

3 Replies

:noice:
Vizsla
Happens on the vercel deployment? Maybe some more context could be helpful here - are you getting this error on preview or prod deploys? Does this happen locally?
Where is this function located in your file structure, could be something there to note