SupabaseS
Supabase2y ago
roga

Prisma Enum Problems - Vercel throwing "blocked by client" errors

In my composables, if I try to import Prisma schema enums I get a host of errors when hosting on Vercel.

The errors:
TypeError: Failed to resolve module specifier ".prisma/client/index-browser". Relative references must start with either "/", "./", or "../".
K @ entry.61202b1d.js:5

[nuxt] error caught during app initialization TypeError: Failed to resolve module specifier ".prisma/client/index-browser". Relative references must start with either "/", "./", or "../".

Failed to load resource: net::ERR_BLOCKED_BY_CLIENT

Failed to load resource: net::ERR_BLOCKED_BY_CLIENT


The import statement:
import { type Vehicle, SalesStatus } from '@prisma/client';


This works just fine in development. However, in preview/production on Vercel, the above errors appear in the client console and the content of the page will not load.

The simplest fix I've found that magically makes everything work is to create a type of my own and remove the enum altogether.

import { type Vehicle } from '@prisma/client';
type SalesStatus = 'SOLD' | 'PENDING' | 'AVAILABLE' | 'DELIVERED';


I'm trying to understand why this is happening. If you have any insight, it would be greatly appreciated.

Ideally, I'd like to use the Prisma client to extract and use these enums because things may change in the schema later. If we decide to change things, I don't want to have to go digging into my code to find where things have broken, obviously.

Thanks in advance for any help/insight you can provide! 🙏
Was this page helpful?