Babadur
Babadur
DTDrizzle Team
Created by Babadur on 5/7/2024 in #help
No Overload Matches this call on insert
that removed the error, thanks! I was also getting it for another field and I tried swapping it around too but it didnt fix it so I just casted it as any.
8 replies
DTDrizzle Team
Created by Babadur on 5/7/2024 in #help
No Overload Matches this call on insert
yeah sorry I said insert, its actually on a select, I changed just edited the original message
8 replies
DTDrizzle Team
Created by Babadur on 5/7/2024 in #help
No Overload Matches this call on insert
it is on a select
8 replies
DTDrizzle Team
Created by Babadur on 5/7/2024 in #help
No Overload Matches this call on insert
Here is my getUser function:
export async function getUser() {
const user = auth()

if (!user.userId) throw new Error("Unauthorized")

const clerkId = user.userId;

console.log("here")

const result = await db.select().from(users).where(eq(users.clerkId, clerkId));

console.log(result[0])
return result[0]
}
export async function getUser() {
const user = auth()

if (!user.userId) throw new Error("Unauthorized")

const clerkId = user.userId;

console.log("here")

const result = await db.select().from(users).where(eq(users.clerkId, clerkId));

console.log(result[0])
return result[0]
}
8 replies
DTDrizzle Team
Created by Babadur on 5/7/2024 in #help
No Overload Matches this call on insert
I am getting it on the user.id line. Here is my user and waitlist schema:
export const users = sqliteTable("users", {
id: integer("id").primaryKey().notNull().unique(),
clerkId: text("clerkId").notNull().unique(),
email: text("email").notNull(),
tier: text("tier", { enum: ["free", "pro", "enterprise"] }).default("free"),
firstName: text("firstName").notNull(),
numWaitlists: integer("numWaitlists"),
createdAt: text("created_at").default(sql`CURRENT_TIMESTAMP`),
});
export const users = sqliteTable("users", {
id: integer("id").primaryKey().notNull().unique(),
clerkId: text("clerkId").notNull().unique(),
email: text("email").notNull(),
tier: text("tier", { enum: ["free", "pro", "enterprise"] }).default("free"),
firstName: text("firstName").notNull(),
numWaitlists: integer("numWaitlists"),
createdAt: text("created_at").default(sql`CURRENT_TIMESTAMP`),
});
export const waitlists = sqliteTable("waitlists", {
id: integer("id").primaryKey().notNull().unique(),
userId: integer("userId")
.notNull()
.references(() => users.id),
limit: integer("limit"),
count: integer("count").default(0),
createdAt: text("created_at").default(sql`CURRENT_TIMESTAMP`),
updatedAt: text("updated_at").default(sql`CURRENT_TIMESTAMP`).$onUpdate(() => sql`CURRENT_TIMESTAMP`),
title: text("title").notNull(),
color: text("color"),
video: text("video"),
copy: text("copy").notNull()
});
export const waitlists = sqliteTable("waitlists", {
id: integer("id").primaryKey().notNull().unique(),
userId: integer("userId")
.notNull()
.references(() => users.id),
limit: integer("limit"),
count: integer("count").default(0),
createdAt: text("created_at").default(sql`CURRENT_TIMESTAMP`),
updatedAt: text("updated_at").default(sql`CURRENT_TIMESTAMP`).$onUpdate(() => sql`CURRENT_TIMESTAMP`),
title: text("title").notNull(),
color: text("color"),
video: text("video"),
copy: text("copy").notNull()
});
8 replies