TypeError: Do not know how to serialize a BigInt

I have defined the following schema:

export const customer = pgTable("customer", {
    id: bigserial("id", { mode: "number" }).primaryKey(),
    name: text("name"),
    email: text("email").unique(),
// ...
    createdAt: timestamp("created_at").notNull().defaultNow(),
    updatedAt: timestamp("updated_at"),
})


export const event = pgTable("event", {
    id: bigserial("id", { mode: "number" }).primaryKey(),
    name: varchar("name").notNull().unique(),
    description: text("description"),
    startDate: date("start_date").notNull(),
    endDate: date("end_date").notNull(),
// ...
    createdAt: timestamp("created_at").notNull().defaultNow(),
    updatedAt: timestamp("updated_at"),
})


export const eventRegistration = pgTable("event_registration", {
    id: bigserial("id", { mode: "number" }).primaryKey(),
    createdAt: timestamp("created_at").notNull().defaultNow(),
    eventId: bigint("event_id", { mode: "number" }).notNull().references(() => event.id),
    customerId: bigint("customer_id", { mode: "number" }).notNull().references(() => customer.id),
    registrationDateTime: timestamp("registration_date_time").notNull(),
// ...
})


When I open up drizzle studio, and go in to the Drizzle runner table, and enter the following query:

db.select().from(customer).innerJoin(eventRegistration, eq(eventRegistration.customerId, customer.id));


The browser view goes blank, and I see the following error in the browser dev console:

Uncaught TypeError: Do not know how to serialize a BigInt
    at JSON.stringify (<anonymous>)


Anyone have any idea what I'm missing or doing wrong, and what I might be able to do to fix it?
Was this page helpful?