I have the example SQL schema from Cloudflare's docs:
CREATE TABLE IF NOT EXISTS Customers (CustomerId INTEGER PRIMARY KEY, CompanyName TEXT, ContactName TEXT);
INSERT INTO Customers (CustomerID, CompanyName, ContactName) VALUES (1, 'Alfreds Futterkiste', 'Maria Anders'), (4, 'Around the Horn', 'Thomas Hardy'), (11, 'Bs Beverages', 'Victoria Ashworth'), (13, 'Bs Beverages', 'Random Name');
And this Kysely code (removed some Worker boiler plate code for simplicity):
import { Kysely } from 'kysely';
import { D1Dialect } from 'kysely-d1';
import { Env } from '../env';
interface Customers {
CustomerID: number;
CompanyName: string;
ContactName: string;
}
interface Database {
Customers: Customers;
}
const db = new Kysely<Database>({ dialect: new D1Dialect({ database: env.DB }) });
await db
.insertInto('Customers')
.values({
CustomerID: 7,
ContactName: 'test',
CompanyName: 'test',
}).execute();
When the Worker runs, it successfully creates a row in the table but throws the following error:
Do not know how to serialize a BigInt
I have the example SQL schema from Cloudflare's docs:
And this Kysely code (removed some Worker boiler plate code for simplicity):
When the Worker runs, it successfully creates a row in the table but throws the following error: