Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrismaClientInitializationError #24210

Open
iamzainn opened this issue May 15, 2024 · 4 comments
Open

PrismaClientInitializationError #24210

iamzainn opened this issue May 15, 2024 · 4 comments
Labels
bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: windows

Comments

@iamzainn
Copy link

iamzainn commented May 15, 2024

Bug description

I am recentlly working on next js 14 project. For backent i choose prisma orm with supabase as a database.
Now i follow each and every step of prisma.
on Server off (npm run dev )
All steps working fine prisma generate / prisma migrate . each and everything working fine.
But on Server on in my web app where i user prisma its throw an error that
Prisma Client is not initialized and since my server is on npx prisma generate also show an Error :

  EPERM:  operation not permitted, unlink 'C:\Users\zainn\Desktop\redit\reddit\node_modules\.prisma\client\query_engine-windows.dll.node .

I uses this code for generating prisma client . in my next js as i know its best practises

import { PrismaClient } from "@prisma/client";

const prismaClientSingleton = () => {
  return new PrismaClient();
};

declare global {
  var prismaGlobal: undefined | ReturnType<typeof prismaClientSingleton>;
}

const prisma = globalThis.prismaGlobal ?? prismaClientSingleton();

export default prisma;

if (process.env.NODE_ENV !== "production") globalThis.prismaGlobal = prisma;

Then i fetch prisma from here to use it but its throw error how to resolve this issue guide me.....

MAIN ERROR THAT IS SHOWING :

 ⨯ PrismaClientInitializationError: 
Invalid `prisma.user.findUnique()` invocation:

Can't reach database server at `aws-0-ap-south-1.pooler.supabase.com:6543`

Please make sure your database server is running at `aws-0-ap-south-1.pooler.supabase.com:6543`.
    at In.handleRequestError (C:\Users\zainn\Desktop\redit\reddit\node_modules\@prisma\client\runtime\library.js:122:7177)
    at In.handleAndLogRequestError (C:\Users\zainn\Desktop\redit\reddit\node_modules\@prisma\client\runtime\library.js:122:6211)       
    at In.request (C:\Users\zainn\Desktop\redit\reddit\node_modules\@prisma\client\runtime\library.js:122:5919)
    at async l (C:\Users\zainn\Desktop\redit\reddit\node_modules\@prisma\client\runtime\library.js:127:11167)
    at async GET (webpack-internal:///(rsc)/./src/app/api/auth/creation/route.ts:24:18)
    at async C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:53446
    at async e_.execute (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:44747)
    at async e_.handle (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:54700)
    at async doRender (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\server\base-server.js:1377:42)
    at async cacheEntry.responseCache.get.routeKind (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\server\base-server.js:1599:28)
    at async DevServer.renderToResponseWithComponentsImpl (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\server\base-server.js:1507:28)
    at async DevServer.renderPageComponent (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\server\base-server.js:1924:24)  
    at async DevServer.renderToResponseImpl (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\server\base-server.js:1962:32) 
    at async DevServer.pipeImpl (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\server\base-server.js:920:25)
    at async NextNodeServer.handleCatchallRenderRequest (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\server\next-server.js:272:17)
    at async DevServer.handleRequestImpl (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\server\base-server.js:816:17)     
    at async C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\server\dev\next-dev-server.js:339:20
    at async Span.traceAsyncFn (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\trace\trace.js:154:20)
    at async DevServer.handleRequest (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\server\dev\next-dev-server.js:336:24)
    at async invokeRender (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\server\lib\router-server.js:174:21)
    at async handleRequest (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\server\lib\router-server.js:353:24)
    at async requestHandlerImpl (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\server\lib\router-server.js:377:13)
    at async Server.requestListener (C:\Users\zainn\Desktop\redit\reddit\node_modules\next\dist\server\lib\start-server.js:141:13) {
  clientVersion: '5.14.0',
  errorCode: undefined
}

How to reproduce

Expected behavior

No response

Prisma information

// Add your schema.prisma
// Add your code using Prisma Client

Environment & setup

  • OS:
  • Database:
  • Node.js version:

Prisma Version

5.14.0
@iamzainn iamzainn added the kind/bug A reported bug. label May 15, 2024
@iamzainn
Copy link
Author

prisma version : 5.14.0

@jkomyno
Copy link
Contributor

jkomyno commented May 17, 2024

Hi @iamzainn, what version of Windows are you in, and what Node.js version are you using?
Are you in a 64-bit operating system?

@jkomyno jkomyno added bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. team/client Issue for team Client. labels May 17, 2024
@iamzainn
Copy link
Author

brother, i am using node v20. and 64bit window os.

@Jolg42
Copy link
Member

Jolg42 commented May 28, 2024

About EPERM: operation not permitted, unlink 'C:\Users\zainn\Desktop\redit\reddit\node_modules\.prisma\client\query_engine-windows.dll.node . we have a few issues about this at the moment, like
#20090
To avoid this, make sure your local dev server or prisma studio is not running, for example.


Please make sure your database server is running at `aws-0-ap-south-1.pooler.supabase.com:6543`.

This error is most likely a problem in the connection string or in the network

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: windows
Projects
None yet
Development

No branches or pull requests

3 participants