chris_st
Explore posts from serversBABetter Auth
•Created by chris_st on 4/20/2025 in #help
The table `main.verification` does not exist in the current database.
(I presume you mean in the sqlite3 database)
15 replies
BABetter Auth
•Created by chris_st on 4/20/2025 in #help
The table `main.verification` does not exist in the current database.
Yes
15 replies
BABetter Auth
•Created by chris_st on 4/20/2025 in #help
The table `main.verification` does not exist in the current database.
import { PrismaClient } from '@prisma/client'
import { PrismaD1 } from '@prisma/adapter-d1'
const prismaClients = {
async fetch(db: D1Database) {
const adapter = new PrismaD1(db)
return new PrismaClient({ adapter })
},
}
export default prismaClients
15 replies
BABetter Auth
•Created by chris_st on 4/20/2025 in #help
The table `main.verification` does not exist in the current database.
Here is src/lib/prismaClient.ts
15 replies
BABetter Auth
•Created by chris_st on 4/20/2025 in #help
The table `main.verification` does not exist in the current database.
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
// change from default
}
datasource db {
provider = "sqlite"
// d1 is sql base database
url = env("DATABASE_URL")
}
// Create a simple model database
model User {
id String @id @default(uuid())
email String @unique
name String?
emailVerified Boolean
image String?
createdAt DateTime
updatedAt DateTime
sessions Session[]
accounts Account[]
@@map("user")
}
// Create a simple count database
model Count {
id String @id @default(uuid())
count Int
}
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?
createdAt DateTime
updatedAt DateTime
@@map("account")
}
model Verification {
id String @id
identifier String
value String
expiresAt DateTime
createdAt DateTime?
updatedAt DateTime?
@@map("verification")
}
15 replies
BABetter Auth
•Created by chris_st on 4/20/2025 in #help
The table `main.verification` does not exist in the current database.
My prisma/schema.prisma file:
15 replies
BABetter Auth
•Created by chris_st on 4/20/2025 in #help
The table `main.verification` does not exist in the current database.
@KiNFiSH (sorry to take a while to get back)
15 replies
BABetter Auth
•Created by chris_st on 4/20/2025 in #help
The table `main.verification` does not exist in the current database.
I did:
npx prisma generate
wrangler d1 migrations apply hpd1-db --local
Those succeeded, but I get the same error.
15 replies
BABetter Auth
•Created by chris_st on 4/20/2025 in #help
The table `main.verification` does not exist in the current database.
continued from main post
at async Object.createVerificationValue (file:///Users/chris/hacks/podcast-time-machine/experiments/tmp/hono-prisma-d1/node_modules/better-auth/dist/shared/better-auth.Bk5IMdhM.mjs:746:28)
at async file:///Users/chris/hacks/podcast-time-machine/experiments/tmp/hono-prisma-d1/node_modules/better-auth/dist/plugins/email-otp/index.mjs:124:13
at async file:///Users/chris/hacks/podcast-time-machine/experiments/tmp/hono-prisma-d1/node_modules/better-auth/dist/plugins/email-otp/index.mjs:116:11 {
code: 'P2021',
meta: { modelName: 'Verification', table: 'main.verification' },
clientVersion: '6.6.0'
}
--> POST /api/auth/email-otp/send-verification-otp 500 26ms
/start-sign-in sees error { status: 500, statusText: 'Internal Server Error' }
/start-sign-in sees data null
--> POST /start-sign-in 302 53ms
```
Any clues about what to do here VERY much appreciated!
15 replies
BABetter Auth
•Created by chris_st on 3/21/2025 in #help
Server email OTP authentication
@Jacob Thanks for the tips - yeah, I'd seen those docs already. I guess my original post wasn't clear. I don't want to use any client-side javascript at all. Some of the auth techniques, like username/password, can be done entirely server-side, but as near as I can tell, email/otp cannot at the moment. I may look into implementing it in the future, but for now I'm trying to get something built, and the work-around I have is good enough for now. Finishing that project comes first.
5 replies
DTDrizzle Team
•Created by chris_st on 10/19/2024 in #help
Problem with findMany with many-to-many relations
Nope, just did a big wad of SQL.
6 replies
DTDrizzle Team
•Created by chris_st on 10/19/2024 in #help
Problem with findMany with many-to-many relations
Finally, the output:
entriesFound is [
{
"Id": 2,
"PersonId": 1,
"Content": "Another entry with a tagmarker in it.",
"Timestamp": "2024-10-19T19:30:11.173Z",
"EntriesTags": [
{
"EntryId": 2,
"TagId": 1
}
]
},
{
"Id": 1,
"PersonId": 1,
"Content": "This is a new entry with tags in it.",
"Timestamp": "2024-10-19T19:30:03.568Z",
"EntriesTags": [
{
"EntryId": 1,
"TagId": 1
},
{
"EntryId": 1,
"TagId": 2
},
{
"EntryId": 1,
"TagId": 4
}
]
}
]
Which is really not what I want at all. I want the content of the tags, not the EntryId/TagId pairs. I'm following the https://orm.drizzle.team/docs/rqb#many-to-many many-to-many documentation as closely as I can; I think the
with
part should be:
with: {
Tags: true,
},
But that fails with an error:
ERR main getEntriesForPerson got error TypeError: Cannot read properties of undefined (reading 'referencedTable')
Any help very much appreciated!6 replies
DTDrizzle Team
•Created by chris_st on 10/19/2024 in #help
Problem with findMany with many-to-many relations
Second, here's how I'm querying it:
export const getEntriesForPerson = async (
context: LocalContext,
personId: number
): Promise<EntryList | string> => {
try {
const entriesFound = await getEntriesDb(
context
).query.Entries.findMany({
with: {
EntriesTags: true,
},
where: eq(schema.Entries.PersonId, personId),
limit: 20,
orderBy: [desc(schema.Entries.Timestamp)],
})
console.log(
entriesFound is ${JSON.stringify(entriesFound, null, 2)})
return ok({ entries: entriesFound })
} catch (error: any) {
logTapeLogger.error(
getEntriesForPerson got error ${error.toString()})
return err(error.toString())
}
}
6 replies
DTDrizzle Team
•Created by chris_st on 10/15/2024 in #help
Help with 'in' queries
For anyone else who finds this, trying to deal with this, evidently the
inArray
operator allows this type of query: https://orm.drizzle.team/docs/operators#inarray2 replies