I rely heavily on the [d1 http api](https://developers.cloudflare.com/api/operations/cloudflare-d1-q

I rely heavily on the d1 http api in my postgres app. I am trying to use d1 as an edge cache to postgres so that cloudflare workers can connect directly to d1 instead of postgres reducing latency. In order to do that I added an insert trigger in postgres to call the
d1 http api
. Here is the issue that I am facing
D1 api sometimes fails randomly with no clear reason. I have implemented a queue system to collect all of the failed calls and here are some error msgs I get

  • {"content":"{\"success\":false,\"errors\":[{\"code\":10000,\"message\":\"Authentication error\"}]}\n","error_msg":null,"status_code":500}
    (Strange, as I do not change authentication and only some calls fail with this error
  • {"content":"{\n \"result\": null,\n \"success\": false,\n \"errors\": [\n {\n \"code\": 7501,\n \"message\": \"Internal error: D1 API returned: (503 Service Unavailable) [truncate html, see screenshot]
  • {"content":"{\n \"result\": null,\n \"success\": false,\n \"errors\": [\n {\n \"code\": 7502,\n \"message\": \"Internal error: db error: FATAL: server conn crashed?\"\n }\n ],\n \"messages\": []\n}","error_msg":null,"status_code":500}
  • {"content":"{\n \"result\": [],\n \"success\": false,\n \"errors\": [\n {\n \"code\": 7500,\n \"message\": \"Cannot resolve D1 due to transient issue on remote node.\"\n }\n ],\n \"messages\": []\n}","error_msg":null,"status_code":500}
  • {"content":"{\n \"result\": null,\n \"success\": false,\n \"errors\": [\n {\n \"code\": 7500,\n \"message\": \"Internal error: Flipper failed: Flipper API returned: error sending request for url (https://flipper.sd.cfplat.com/features/edgeworker?acct=8640544): error trying to connect: dns error: failed to lookup address information: Name or service not known\"\n }\n ],\n \"messages\": []\n}","error_msg":null,"status_code":500}
image.png
Interact with Cloudflare's products and services via the Cloudflare API
Was this page helpful?