#Server action is running on client-side on Vercel deployment

4 messages · Page 1 of 1 (latest)

hasty spire
#

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
round steepleBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

hasty spire
drowsy whale
#

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?