Why I'm getting an error when having db.insert code?

I'm using next js for this project. It gives me an error which called Module not found: Can't resolve 'net'; when I have an "insert into database code" as below:
const onSubmit = async (values: z.infer<typeof SellSchema>) => {
    const { category, description, price, title } = values
    const id = uuidv4()

    db.insert(products).values({
      id: id,
      userId: "5gkltsh2qfx",
      name: title,
      description: description,
      price: price,
    })
 }

I also hard-coded the user id to see if there is any problem with it, but it is still the same. By the way, here is the relevant schemas:

export const users = mysqlTable("user", {
  id: varchar("id", { length: 255 }).notNull().primaryKey(),
  name: varchar("name", { length: 255 }),
  username: varchar("username", { length: 255 }),
  email: varchar("email", { length: 255 }).notNull(),
  password: varchar("password", { length: 255 }),
  image: varchar("image", { length: 255 }),
  institute: varchar("institute", { length: 255 }),
  isSeller: boolean("isSeller").default(false),
})

export const products = mysqlTable("product", {
  userId: varchar("userId", { length: 255 })
    .notNull()
    .references(() => users.id, { onDelete: "cascade" }),
  id: varchar("id", { length: 255 }).notNull().primaryKey(),
  name: varchar("name", { length: 255 }),
  description: text("description"),
  price: double("price", { precision: 6, scale: 2 }),
})

I have been trying to fix this error for days and it is so frustrating. Do anyone know how to fix it? Please let me know 😭
Capture.JPG
Was this page helpful?