D1 & heavy traffic in Production

Hello guys!

For the past week I’ve been setting up Cloudflare Worker to work with D1. Worker is very simple, just few selects from the database & a return response as json.

On local machine it works fine, after deployment it works fine, but if I switch half of our traffic to that worker… we get like 97% crashes by “D1_ERROR”

Could that be because we have up to 100 req/sec traffic or I have to enable some extra settings or Alpha is just not ready for this kind of request amount?

The worker itself is simple, GET request with few parameters - those parameters are used to query/select data from the DB. Response json is being cached after successful return.

D1_ERROR by itself is very abstract:

{
  message: 'D1_ERROR',
  cause: 'Error: Error 9000: something went wrong'
}

Appreciate any advice :slight_smile:

1 Like

Hi! Did you ever find out why?

No answer from my side sadly, but I’ve been getting the same error for the past 2 days and have no idea why.
The error (+stacktrace) I’m getting

Error: D1_ERROR: Error: Error 9000: something went wrong
    at D1Database._send (index.js:2356:13)
    at async D1PreparedStatement.all (index.js:2426:7)

Since the stacktrace shows D1PreparedStatement.all I’m guessing this is from a SELECT operation. My D1 database is being read/written to every 10 minutes, and I’m getting this errors sporadically (twice yesterday at 15:30 CEST, once yesterday at 19:30 PM and once today at 16:50).

For the moment I’m dismissing it as “an alpha error”, but hopefully has nothing to do with the data.

Did you guys solve it? Is this still a problem in Beta? @Tuto @jsmrcaga