wrangler d1 migrations apply my-db --localworkerd/jsg/util.c++:274: error: e = workerd/util/sqlite.c++:413: failed: expected _ec == SQLITE_OK [14 == 0]; unable to open database file: SQLITE_CANTOPEN
stack: 7ff6fb11418c 7ff6fb5a31aa 7ff6fb5a2959 7ff6fafab7bb 7ff6fafab54b 7ff6fb1b2738 7ff6fb1b2589 7ff6fb1b0d3f 7ff6fb1799ff 7ff6fb1791d2 7ff6fafaa577 7ff6fafa9da8 7ff6fafa9bdb 7ff6fafa6ff1 7ff6fafa6d33 7ff6fafadfd3 7ff6fafc9cd7 0 7ff6fb6a2c7c 0 0 0; sentryErrorContext = jsgInternalError/cdn-cgi/trace on your worker's hostname, look for colo=<airportCode>. If you have Smart Placement enabled, then check the cf-placement response header, end of that is airport code.npx wrangler d1 info <dbName>, If you're not sure. you'll get a region returned like ENAM (East North America), or APAC (Asia Pacific)duration You can also do performance.now before/after query to measure end to end latency of each query and shove it into a response header or console.log itnpx wrangler d1 insights <db> can be helpful for debugging slow queries as well
D1PreparedStatement has a statement property, but TS doesn't know about itpreparedStatement.statement is not meant to be used by client Worker code (i.e. you). You have access to the statement since you are the one providing it to the prepare() method, so use that instead.prepare() and optionally bind(), only call these methods: https://developers.cloudflare.com/d1/worker-api/prepared-statements/When using Durable Objects, it's important to remember that they are intended to scale out, not up. A single object is inherently limited in throughput since it runs on a single thread of a single machine. To handle more traffic, you create more objects. This is easiest when different objects can handle different logical units of state (like different documents, different users, or different "shards" of a database), where each unit of state has low enough traffic to be handled by a single object.
workerd/jsg/util.c++:274: error: e = workerd/util/sqlite.c++:413: failed: expected _ec == SQLITE_OK [14 == 0]; unable to open database file: SQLITE_CANTOPEN
stack: 7ff6fb11418c 7ff6fb5a31aa 7ff6fb5a2959 7ff6fafab7bb 7ff6fafab54b 7ff6fb1b2738 7ff6fb1b2589 7ff6fb1b0d3f 7ff6fb1799ff 7ff6fb1791d2 7ff6fafaa577 7ff6fafa9da8 7ff6fafa9bdb 7ff6fafa6ff1 7ff6fafa6d33 7ff6fafadfd3 7ff6fafc9cd7 0 7ff6fb6a2c7c 0 0 0; sentryErrorContext = jsgInternalErrorwrangler d1 backup create cyguro-db-dev
✘ [ERROR] A request to the Cloudflare API (/accounts/2d2da569ea5c41d87eba7d610279d290/d1/database/c25c6f21-3669-4672-9eaf-58242589258c/backup) failed.
The request is malformed: Only alpha D1 databases support backups. Production databases support
time-travel: c25c6f21-3669-4672-9eaf-58242589258c (v3) [code: 7400]const [ widget ] = await db.select().from(schema.widgets).where( eq(schema.widgets.id, widget_id) ).limit(1)D1PreparedStatementstatementTSpreparedStatement.statementprepare()prepare()bind()// This code works
const ps = env.DB.prepare(pragmaStmts[key]);
const data = await ps.all();
jsonData.push({ statement: ps.statement, [key]: data.results });
//ts complains:
`Property 'statement' does not exist on type 'D1PreparedStatement'.ts(2339)`# npm ls
@cloudflare/workers-types@4.20241230.0