Jacob | idohtml
Jacob | idohtml
Explore posts from servers
PPrisma
Created by Jacob | idohtml on 4/17/2025 in #help-and-questions
output in schema
About an hour or two?
8 replies
PPrisma
Created by Jacob | idohtml on 4/17/2025 in #help-and-questions
output in schema
I fixed it but I am not currently at home to explain it for you 😂
8 replies
BABetter Auth
Created by Jacob | idohtml on 4/18/2025 in #help
server actions for users
Thanks again Kinfish 😂 ❤️
8 replies
BABetter Auth
Created by Jacob | idohtml on 4/18/2025 in #help
server actions for users
That explains that struggle prettier clearly as well
8 replies
BABetter Auth
Created by Jacob | idohtml on 4/18/2025 in #help
server actions for users
Well then
8 replies
BABetter Auth
Created by Jacob | idohtml on 4/18/2025 in #help
server actions for users
So how I usually prefer to setup my users action is in a user.actions.ts file inside the actions directory. Here I place all the server actions a user should be able to do such as sign in a user with credentials, sign out a user, sign in, get the user id or update their profile in some sort of way. But since Better-auth already seems to have this built into their api (auth.api... or authClient.api...) I don't really know how to setup this file anymore and it's a bit confusing to me.
8 replies
BABetter Auth
Created by Jacob | idohtml on 4/17/2025 in #help
Prisma + better-auth: schema type issue
Well however. Thank you so, so much for the help provided. I appreciated it highly mate 🙏
25 replies
BABetter Auth
Created by Jacob | idohtml on 4/17/2025 in #help
Prisma + better-auth: schema type issue
That's so good to know
25 replies
BABetter Auth
Created by Jacob | idohtml on 4/17/2025 in #help
Prisma + better-auth: schema type issue
I used to do it like this before
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
25 replies
BABetter Auth
Created by Jacob | idohtml on 4/17/2025 in #help
Prisma + better-auth: schema type issue
Yeah seems to work now but I still don't understand why I need that output thing?
25 replies
BABetter Auth
Created by Jacob | idohtml on 4/17/2025 in #help
Prisma + better-auth: schema type issue
ryt?
25 replies
BABetter Auth
Created by Jacob | idohtml on 4/17/2025 in #help
Prisma + better-auth: schema type issue
Like this right?
import { PrismaClient } from "@/prisma/app/generated/prisma/client";

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

declare const globalThis: {
prismaGlobal: ReturnType<typeof prismaClientSingleton>;
} & typeof global;

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

export default prisma;

if (process.env.NODE_ENV !== "production") globalThis.prismaGlobal = prisma;
import { PrismaClient } from "@/prisma/app/generated/prisma/client";

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

declare const globalThis: {
prismaGlobal: ReturnType<typeof prismaClientSingleton>;
} & typeof global;

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

export default prisma;

if (process.env.NODE_ENV !== "production") globalThis.prismaGlobal = prisma;
25 replies
BABetter Auth
Created by Jacob | idohtml on 4/17/2025 in #help
Prisma + better-auth: schema type issue
import { PrismaClient } from "@prisma/client";

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

declare const globalThis: {
prismaGlobal: ReturnType<typeof prismaClientSingleton>;
} & typeof global;

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

export default prisma;

if (process.env.NODE_ENV !== "production") globalThis.prismaGlobal = prisma;
import { PrismaClient } from "@prisma/client";

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

declare const globalThis: {
prismaGlobal: ReturnType<typeof prismaClientSingleton>;
} & typeof global;

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

export default prisma;

if (process.env.NODE_ENV !== "production") globalThis.prismaGlobal = prisma;
25 replies
BABetter Auth
Created by Jacob | idohtml on 4/17/2025 in #help
Prisma + better-auth: schema type issue
import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { nextCookies } from "better-auth/next-js";
import prisma from "./database/prisma";

export const auth = betterAuth({
database: prismaAdapter(prisma, {
provider: "postgresql",
}),
secret: process.env.AUTH_SECRET!,
emailAndPassword: {
enabled: true,
autoSignIn: false,
},
plugins: [nextCookies()],
});
import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { nextCookies } from "better-auth/next-js";
import prisma from "./database/prisma";

export const auth = betterAuth({
database: prismaAdapter(prisma, {
provider: "postgresql",
}),
secret: process.env.AUTH_SECRET!,
emailAndPassword: {
enabled: true,
autoSignIn: false,
},
plugins: [nextCookies()],
});
25 replies
BABetter Auth
Created by Jacob | idohtml on 4/17/2025 in #help
Prisma + better-auth: schema type issue
I have done that multiple time but I still get the same error when i fill in the sign up form
25 replies
BABetter Auth
Created by Jacob | idohtml on 4/17/2025 in #help
Prisma + better-auth: schema type issue
No description
25 replies
BABetter Auth
Created by Jacob | idohtml on 4/17/2025 in #help
Prisma + better-auth: schema type issue
OBS ! Here is my schema.prisma file
generator client {
provider = "prisma-client-js"
output = "app/generated/prisma/client"
}

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

model User {
id String @id @default(uuid())
name String?
email String @unique
emailVerified Boolean? // Change from DateTime? to Boolean?
password String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

image String?
sessions Session[]
accounts Account[]

@@map("user")
}

model Session {
id String @id
expiresAt DateTime
token String
createdAt DateTime
updatedAt DateTime
ipAddress String?
userAgent String?
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)

@@unique([token])
@@map("session")
}

model Account {
id String @id
accountId String
providerId String
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
accessToken String?
refreshToken String?
idToken String?
accessTokenExpiresAt DateTime?
refreshTokenExpiresAt DateTime?
scope String?
password String?
type String?
createdAt DateTime
updatedAt DateTime

@@map("account")
}

model Verification {
id String @id
identifier String
value String
expiresAt DateTime
createdAt DateTime?
updatedAt DateTime?

@@map("verification")
}
generator client {
provider = "prisma-client-js"
output = "app/generated/prisma/client"
}

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

model User {
id String @id @default(uuid())
name String?
email String @unique
emailVerified Boolean? // Change from DateTime? to Boolean?
password String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

image String?
sessions Session[]
accounts Account[]

@@map("user")
}

model Session {
id String @id
expiresAt DateTime
token String
createdAt DateTime
updatedAt DateTime
ipAddress String?
userAgent String?
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)

@@unique([token])
@@map("session")
}

model Account {
id String @id
accountId String
providerId String
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
accessToken String?
refreshToken String?
idToken String?
accessTokenExpiresAt DateTime?
refreshTokenExpiresAt DateTime?
scope String?
password String?
type String?
createdAt DateTime
updatedAt DateTime

@@map("account")
}

model Verification {
id String @id
identifier String
value String
expiresAt DateTime
createdAt DateTime?
updatedAt DateTime?

@@map("verification")
}
25 replies
BABetter Auth
Created by Jacob | idohtml on 4/17/2025 in #help
cli generate not working: "Please run prisma generate"
While I have your help could you explain to me how the server actions work with next js or do I have to create a new ticket for that?
12 replies
BABetter Auth
Created by Jacob | idohtml on 4/17/2025 in #help
cli generate not working: "Please run prisma generate"
Yes! You did some voodoo things and it worked for me
12 replies
BABetter Auth
Created by Jacob | idohtml on 4/17/2025 in #help
cli generate not working: "Please run prisma generate"
I guess this issue solved itself?
12 replies