How large is your sql file? Can you reproduce it consistently? Can you share a reproduction if so?
How large is your sql file? Can you reproduce it consistently? Can you share a reproduction if so?

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.... logged to D1 database { result: Promise { <pending> } }INSERTPromisethen 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>