While attempting to update a single field in my database using server-actions and tanstackQuery, I encountered the following error message:
Error: 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: at Object.get (index-browser.js:203:15) at getDataById (get-all-apointment.ts:55:27) at approvedStatus (update-status.ts:11:45) at Object.mutationFn (admin-column.tsx:140:62) at Object.fn (mutation.js:72:29) at run (retryer.js:92:31) at Object.start (retryer.js:133:9) at Mutation.execute (mutation.js:107:40)
To address this issue, I created a server action and utilized tanstack query to execute it. However, upon clicking the approved button
, the aforementioned error occurred.
The affected field in my column is as follows:
export type Events = {
id: string;
title: string;
email: string;
// Other fields...
};
export const columns: ColumnDef<Events>[] = [
/* Column definitions... */
];
Below are the details of my server-action code:
export const approvedStatus = async (id:string) => {
try {
const isExisting = await getDataById(id)
if(!isExisting) return {error: "Data not existing"}
await db.appoinmentSchedule.update({
where: {
id: id
},
data: {
status: 'approved'
}
})
return {succcess: "Event has successuffly updated!"}
} catch (error) {
console.log(error)
throw error
}
}