N
Neon15mo ago
fascinating-indigo

npx prisma db push

npx prisma db push Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma Datasource "db": PostgreSQL database "mydb", schema "public" at "localhost:5432". why did this error keep coming up
15 Replies
stormy-gold
stormy-gold15mo ago
Do you have the connection string set in your .env file?
adverse-sapphire
adverse-sapphire15mo ago
yeah
stormy-gold
stormy-gold15mo ago
Hmm, well localhost:5432" means that it's not the Neon connection string are you trying to connect to a local postgres instance?
adverse-sapphire
adverse-sapphire15mo ago
no i dont think so how would i do that
stormy-gold
stormy-gold15mo ago
Well you can have a local postgres instance running using something like Docker and then you work with your database But if you're trying to connect to Neon then the DATABASE_URL needs to be set in your .env file. So I'd double check that this is done correctly
adverse-sapphire
adverse-sapphire15mo ago
im using nextjs and i have the database url in the env and whenevr i wite npx prisma db push i get the same error
stormy-gold
stormy-gold15mo ago
hmm, well are you sure you only have a single .env file in your project? Next.js uses a .env.local file by default (but also supports .env)
adverse-sapphire
adverse-sapphire15mo ago
yeah i only jave one
stormy-gold
stormy-gold15mo ago
Hmmmm Maybe you can DM me what the file looks like? Because it should work
adverse-sapphire
adverse-sapphire15mo ago
this is the schema.prisma.
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init generator client { provider = "prisma-client-js" previewFeatures = ["driverAdapters"] } datasource db { provider = "postgresql" url = env("DATABASE_URL") }
Prisma
Prisma Accelerate | Make your database queries faster
Accelerate is a managed connection pooler with global caching that helps you speed up your queries with just a few lines of code.
adverse-sapphire
adverse-sapphire15mo ago
this error also comes up Error: P1010: User johndoe was denied access on the database mydb.public
conscious-sapphire
conscious-sapphire15mo ago
@Khalid Can you share the contents of your .env file?
adverse-sapphire
adverse-sapphire15mo ago
KINDE_CLIENT_ID=d3eac9530fda4a35bd7104c0e449ff KINDE_CLIENT_SECRET=Kn8U3eLwJQMwG8iWSgKpso831ux33R5yAUEFCDEDx6wUU3H7Ba KINDE_ISSUER_URL=https://quilss.kinde.com KINDE_SITE_URL=http://localhost:3000 KINDE_POST_LOGOUT_REDIRECT_URL=http://localhost:3000 KINDE_POST_LOGIN_REDIRECT_URL=http://localhost:3000/dashboard DATABASE_URL='postgresql://johndoe:8rNkFzJ3@ep-blue-sound-a2fxepsq.eu-central-1.aws.neon.tech/neondb?sslmode=require'
conscious-sapphire
conscious-sapphire15mo ago
but then I wonder where does the Datasource "db": PostgreSQL database "mydb", schema "public" at "localhost:5432". why did this error keep coming up comes from if you've a correct connection string set up hmm, do you have a minimal reproduction or a GH repository?
adverse-sapphire
adverse-sapphire15mo ago
No I haven’t implemented it into git hub yet

Did you find this page helpful?