Error "@prisma/client did not initialize yet." in Nuxt 4
So tl;dr of the issue is that when calling any API endpoint that uses Prisma I get following error
'@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.\n'
'@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.\n'
My project is using Nuxt 4 with new directory structure and Supabase. Prisma Studio is working normally so in some level the connection between prisma and the database is there.
I have attached screenshot of my directory structure. Anything that looks odd there? I highlighted the prisma related stuff and the API endpoint using it that triggers the error.
I have also attached a screenshot of the API Endpoint where PrismaClient is being imported and used.
Also I should clarify that I have tried to run
npx prisma generate
npx prisma generate
That seemed to run successfully, yet the issue persists.
Essentially it seems to me that in the get-for-user-new API endpoint the following line fails
const prisma = new PrismaClient();
const prisma = new PrismaClient();
Any help would be appreciated. Hope this is enough information.