P
Prisma•6mo ago
astronaut

Data is not showing in table

schema.prisma file.
generator client {
provider = "prisma-client-js"
}


datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

model UserApiLimit {
id String @id @default(cuid())
userId String @unique
count Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
generator client {
provider = "prisma-client-js"
}


datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

model UserApiLimit {
id String @id @default(cuid())
userId String @unique
count Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
prismadb.ts file
import {PrismaClient} from '@prisma/client';

declare global{
var prisma: PrismaClient | undefined;
}

const prismadb = globalThis.prisma || new PrismaClient();

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


export default prismadb;
import {PrismaClient} from '@prisma/client';

declare global{
var prisma: PrismaClient | undefined;
}

const prismadb = globalThis.prisma || new PrismaClient();

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


export default prismadb;
Error on browser console
Error:
Invalid `prisma.userApiLimit.findUnique()` invocation:


error: Environment variable not found: DIRECT_URL.
--> schema.prisma:14
|
13 | provider = "postgresql"
14 | url = env("DIRECT_URL")
|

Validation Error Count: 1
Error:
Invalid `prisma.userApiLimit.findUnique()` invocation:


error: Environment variable not found: DIRECT_URL.
--> schema.prisma:14
|
13 | provider = "postgresql"
14 | url = env("DIRECT_URL")
|

Validation Error Count: 1
No description
8 Replies
Nurul
Nurul•6mo ago
Hey @astronaut 👋 Are you using multiple schema.prisma files? In the schema file that you shared, the url points to DATABASE_URL but in the error message, the url points to DIRECT_URL . What variable have you defined in the .env file? Is it DATABASE_URL or DIRECT_URL?
astronaut
astronaut•6mo ago
DATABASE_URL I used but yesterday I tried DIRECT_URL then I changed it again to DATABASE_URL. no only 1, which I shared
astronaut
astronaut•6mo ago
it stuck here not going further
No description
astronaut
astronaut•6mo ago
I want to create database name with image editor but its my project name and created with schema public in supabase, why ?
alessandroooo
alessandroooo•6mo ago
it seems like its working?? wherre is the issue
astronaut
astronaut•6mo ago
see cursor, its not going forward like showing successfully generated or something like that. It stuck there
astronaut
astronaut•6mo ago
@Nurul for your reference see this https://github.com/prisma/prisma/issues/17338
GitHub
npx prisma migrate dev hangs up · Issue #17338 · prisma/prisma
Bug description When running the command npx prisma migrate dev, it hands up after returning the following message: Environment variables loaded from .env Prisma schema loaded from prisma/schema.pr...
astronaut
astronaut•6mo ago
Stack Overflow
Prisma migrate command gets stuck
I am trying to use Prisma with a local instance of Supabase running on docker. I created a very basic model inside prisma/schema.prisma file: // This is your Prisma schema file, // learn more about...
Want results from more Discord servers?
Add your server