at this point I wonder if theyre waiting until developer week (which is april iirc?) to launch it
at this point I wonder if theyre waiting until developer week (which is april iirc?) to launch it
Error: D1_ERROR: internal error
... logged to D1 database { result: Promise { <pending> } }INSERT.Promise.await instead of then and catch, but I'd like to do this database insertion in a non-blocking way, preferably.await, I see the error, although I believe that makes the database insertion a blocking operation.await. You can't see the value of a Promise before it's completed, and the console.debug({}) is run before the result of the Promise.env and ctx?ExportedHandler and Env?const db = drizzle(env.DB); everywhere they need the db. is that the way to go? or is it still possible to somehow export 1 drizzle client globally?await DB.prepare('SELECT col FROM table WHERE col1 = ?2 AND col2 = ?1 AND col3 = ?1').bind(1, 2).run()Error: D1_ERROR: internal error... logged to D1 database { result: Promise { <pending> } }INSERTPromiseawaitawaitawaitthencatchenvctxExportedHandlerEnvconst db = drizzle(env.DB);await DB.prepare('SELECT col FROM table WHERE col1 = ?2 AND col2 = ?1 AND col3 = ?1').bind(1, 2).run() try {
// Check if the DB is reachable
env.DB.prepare("SELECT 1").first();
const result = env.DB.prepare("INSERT INTO ... (...) VALUES (?, ?, ?, ?)")
.bind()
.run()
.then((result: unknown) => {
console.debug("Insertion result:", result);
})
.catch((error: unknown) => {
console.error("Error inserting data:", error);
throw error; // Rethrow to handle in the catch block
});
console.debug({ ... }, "logged to D1 database", { result });
} catch (err) {
console.error("Insertion into", { env }, "failed", err);
} const result = env.DB.prepare("INSERT INTO ... (...) VALUES (?, ?, ?, ?)")
.bind()
.run(); async fetch(request: Request, env: any): Promise<Response>async fetch(request, env, ctx)