Either a full table scan (which you should try to avoid as it reads every row and is also slow) or a
Either a full table scan (which you should try to avoid as it reads every row and is also slow) or an index read (which is billed like a row read)
EXPLAIN <yourSQLquery> also helps you figure out what SQLite will do and see if you miss indexes.
SQLITE_ERROR errors are coming from SQLite itself, so those are probably not fixable by retries. Retries improve issues like networking hiccups, or servers going down, or other transient things.cause: Error: D1_ERROR: Failed to parse body as JSON, got: error code: 1031 and i have no idea what causes it. I restart my server an it stops doing itFailed to parse body as JSON is thrown when the request body is not a valid JSON, before even validating the actual contents.db = drizzle(env.DB)import { customType } from "drizzle-orm/sqlite-core";
// Custom date type for D1 compatibility - converts Date objects to/from Unix timestamps
// Required for better-auth to work with Cloudflare D1 which doesn't support Date objects
export const D1DateTime = customType<{
data: Date | null;
driverData: number | null;
}>({
dataType() {
return "integer";
},
fromDriver(value: number | null): Date | null {
return value ? new Date(value * 1000) : null; // Convert from Unix seconds to Date
},
toDriver(value: Date | null): number | null {
return value ? Math.floor(value.getTime() / 1000) : null; // Convert Date to Unix seconds
},
});cause: Error: D1_ERROR: Failed to parse body as JSON, got: error code: 1031Failed to parse body as JSONdb = drizzle(env.DB)