Cloudflare Developers

CD

Cloudflare Developers

Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news

Join

You need to provide us database IDs to

You need to provide us database IDs to be able to look anything for you. Also, some details on volume, queries, how much data are you returning each time, etc are helpful.
This is from the HKG PoP and with a D1 instance in APAC
APAC is a huge region and you could be 100-200ms away from your database unfortunately. Having said that anything more than a few hundreds of ms even in those cases is a bigger unexpected issue, either with the responses getting back to your worker or something else. ...

was anyone able to use Prisma + D1? My

was anyone able to use Prisma + D1? My app works locally but when I deploy it to Cloudflare i'm getting the error: fs.readdir is not implemented yet. Why would Prisma need access to the filesystem if it is configured to connect to D1? Its a real showstopper for me. I guess i will have to self-host the app if there is no solution.

status dashboard says no, but just for

status dashboard says no, but just for my sanity there's no known issue with d1 is there? getting sudden huge spikes in latency (47,000ms) for very simple requests which were fine previously ``` const findActivityStartTime = performance.now(); const activity = await prisma.activity.findFirst({...

This is good advice, but it’s not

This is good advice, but it’s not exactly the same as D1, for example time travel backups doesn’t exist for durable objects (afaik) and no API support

how do you make this work, are you

how do you make this work, are you deploying a worker inside the account to act as a proxy?

D1 connection string

are there any plans on offering a conection string to be able to visualize and manipulate a db with dabatabes visualizer like dbeaver? the d1 database explorer is honestly the worst feature there is from you. I can't search, I can't filter. It's so basic. Why don't you just rely on existent (open source) software for this? this vendor locking seems really silly...

Minimum D1 permissions for HTTP API

Can you try make a token with just edit?

Low latency D1 for hourly config updates

If you rarely update that config and you have many requests needing it, then you can have D1 as the source of truth where you write your config updates, and then also put them in Workers KV. Your worker can read from Workers KV when a stale value (up to 60s) is OK for that case, and go to D1 if you need the latest/freshest configuration. Using the local CDN Cache API from your worker sometimes give you faster lookups than Workers KV as well, but it also depends on your scenario. It's not clear from what you said above. This design can give you the speed when you can use cached values and have D1 as a fallback for your endpoints that need the latest....

Migration timeout

What is your database ID?
I've just send you a DM.
Are other queries working, and only that specific migration failing?...

Durable Objecte SQLite

Yeah, SQLite in DO launched a few months ago, but it has been used by D1 for more than a year now. If you also want to see how to think about using many DOs check out https://developers.cloudflare.com/reference-architecture/diagrams/storage/durable-object-control-data-plane-pattern/ I have a real example implementing that pattern explained in https://www.lambrospetrou.com/articles/tiddlyflare/...

Is anyone aware of an existing tool that

Is anyone aware of an existing tool that will take a D1 export and save the file directly to R2? I know I can do all this programmatically but I was hoping there was a simpler way or a pre-existing tool for it already. Thanks

How would I get just the `results` from

How would I get just the results from the return Response.json(results) area? I'm getting this:
{"success":true,"meta":{"served_by":"v3-prod","duration":0.1977,"changes":0,"last_row_id":0,"changed_db":false,"size_after":16384,"rows_read":1,"rows_written":0},"results":[{"test":"a"}]}
{"success":true,"meta":{"served_by":"v3-prod","duration":0.1977,"changes":0,"last_row_id":0,"changed_db":false,"size_after":16384,"rows_read":1,"rows_written":0},"results":[{"test":"a"}]}
...

yes i did this query

yes i did this query ```js const [total_records, users] = await Promise.all([ prisma.user.count({ where: whereClause...

No, it first fails on parsing the sql

No, it first fails on parsing the sql because of the missing quotes around the dates. Once i fixed that it succeeds parsing the sql and then breaks with the d1_reset_do error. I wrote a script to chunk the inserts in the dump so hopefully that works out but the export 100% has some issue...

Hmm unless I'm missing something, this

Hmm unless I'm missing something, this doesn't seem to be possible? It'd be really helpful to be able to develop locally and see the metrics to help designing database and estimating costs. .all and .batch do return those metrics, but it's very intrusive to modify your code....

Thank you!!! ddbb159c-feb2-4ff0-a86c-

Thank you!!! ddbb159c-feb2-4ff0-a86c-022d0d3b336a

I'm trying to import data from an sql

I'm trying to import data from an sql file trough the http api but getting statement too long: SQLITE_TOOBIG error. The whole sql file is 24mb and has one insert statement per line (each statement ends with a semicolon followed by a line break). The table has 13 columns I'm inserting into. The longer insert statement line is 751 byte. Are there any limitations for the D1 HTTP API I'm not aware of? Could this be a bug? Or I'm maybe doing something wrong? Update: Problem was with quotes not been escaped. Escaped those by doubling them and the problem was solved!...

Unexplained row reads in billable usage

Did anyone else had any unexplained reporting in billable usage for D1? On the 25th of October it's saying it suddenly had 1 million row reads, though it's not verifiable through the D1 analytics page, see thread for screenshots:

Hello. I'm getting this error when

Hello. I'm getting this error when running npx drizzle-kit push command. Anyone know what's going on? ``` [âś“] Pulling schema from database... Error: 7500: not authorized: SQLITE_AUTH...