Am I doing something wrong here? I'm trying to close a websocket immediately. Would prefer to have i
Am I doing something wrong here? I'm trying to close a websocket immediately. Would prefer to have instant closure.
14 Replies
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
webSocketError()
would run if something broke on the WebSocket, not if your application code threw an exception. If you're just calling a func/method that can throw and you want to handle exceptions you should wrap it in a try...catch
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
No prob!
>"The Durable Object's code has been updated, this version can no longer access storage."
How can this happen if we dont deploy a new version?
separate question: is there a suggested pattern for setting a TTL on durableobject storage? e.g. "clear after 1 hour?" alarms?
Likely a runtime update (meaning the runtime,
workerd
, or the underlying storage that backs Durable Objects).could also be caused by tailing
So Sqlite durable objects Vs D1. When does this change the decision matrix to use one or the other? JSON blobs?
DO SQLite is more of a lower level primitive that you can use to build your own solution. It's missing most of the things that D1 does/will eventually bring like replication, any cross-DB querying, etc.
If you wanted to build the next D1: use DO SQLite, but if you just want a database you can easily access and query from Workers or the Cloudflare API then use D1.
Also DO SQLite has lower limits currently.
also I think the big one rn is just DO KV is production ready stable / DO SQlite is not
so to be clear, that error message could actually be triggered for reasons unrelated to what it says in the error message, right?
like the "root cause" error would be a runtime update
By "the code has been updated" it doesn't necessarily mean your code, just some code on the DO. So yes.
got it that makes sense
Sane retries are recommended from your worker calling the do, there's an example here: https://developers.cloudflare.com/durable-objects/best-practices/error-handling/
Cloudflare Docs
Error handling | Cloudflare Durable Objects docs
Review how to handle errors (exceptions) generated by both your own Durable Object code as well as exceptions thrown by Durable Objects’ infrastructure (such as overloads or network errors).