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

access Durable Object Id from within the DO

huh so this works great when I create the durable object. But breaks within the do For example this works...

drizzle with DO SQLite

sort of, i use drizzle kit to manage migrations and a custom query proxy which applies the same types used in drizzle kit to queried results (i.e. int to js date, etc.)

Hi everyone, I'm new to durable objects

Hi everyone, I'm new to durable objects and don't understand much from the front page of their docs. (This seems to be a trend with CF; the docs could definitely be more non-expert-friendly. Reading "without requiring you to build serialization and coordination primitives on your own." on the very first page is quite daunting). I would like to understand what this product is and whether it matches my need. I need something that can power websocket-like behaviour to buld a realtime chat. Previously I've used pusher.com for this. Is that the sort of thing DO is? Or how does it compare to Queues, which, to a layman like me, also sounds sort of like what's needed? Any layman help appreciated! 🙂...

Hello.

Hello.
Locally - I would like to have a module (A) with just a Durable Object (no Worker). Another module (B) has a Worker (could also be a Durable Object). Can the Worker module (B) make an RPC call into DO module (A)? If i try this i get an error...
DataCloneError: Could not serialize object of type "JsRpcPromise"....

Hey 👋 I have a DO based off of this

Hey 👋 I have a DO based off of this https://github.com/cloudflare/workers-chat-demo and its working great.. but client connected sockets timeout (close with code 1006) if no messages are sent after exactly 3 minutes.. is this expected? I have tried calling state.setWebSocketAutoResponse in the DO constructor (not sure how to use this method) but that didn't seem to do much. Do I need to have connected clients send a ping messages to the DO at a regular interval to keep the connection open? If so, does this wake the socket from hibernation (and thus incur a charge)?...

I think I've found a bug in the SQLite

I think I've found a bug in the SQLite backend - calling deleteAll() in an alarm handler results in an internal error, unless I call deleteAlarm() first

Theoretically, how many clients could I

Theoretically, how many clients could I support on my Durable Object websocket? Ignore the messages themselves....

thank you, what I was missing is that

thank you, what I was missing is that there is another option besides the RPC for querying DO

Hey, I can't make a new durable object :

Hey, I can't make a new durable object :
Cannot create binding for class 'Trainer' because it is not currently configured to implement durable objects. Did you forget to apply a --new-class migration to it? [code: 10061]
Cannot create binding for class 'Trainer' because it is not currently configured to implement durable objects. Did you forget to apply a --new-class migration to it? [code: 10061]
But if I try to add it ...

Am I doing something wrong here? I'm

Am I doing something wrong here? I'm trying to close a websocket immediately. Would prefer to have instant closure. ```typescript #reject_websocket(code?: number, reason?: string) { let { 0: webSocket, 1: server } = new WebSocketPair()...

Persist DO alive during worker deploy

yeah and as a result, websockets are closed from the DO (acting as a listener of my external node). It can be very dangerous because the DO listen for a payment through the websocket. Then, any deploy to the worker kills all the connections. Although alarms could re-open the connections, it can be too late....

DO multi-worker example?

Hi, I'm looking for a multi-worker example where say worker_a calls RPC methods running in a DO whose class implementation lives in worker_b. The example in the rpc docs shows a services binding to a worker (by name). ``` services = [...

I created a real-time server using

I created a real-time server using Durable Objects and WebSocket. The logs confirm that both the Worker and the DO are in the SJC data center. Pinging the Worker's domain shows a latency of 2ms, but when messages are returned via WebSocket, the latency is as high as 70ms. Is the communication latency between the Worker and the DO really that high?

I didn’t see this graph before. But yeah

I didn’t see this graph before. But yeah, you can see that for the whole 2 hours, each minute (other than a few blips) I was charged 23 GB-sec per minute, even though the requests graph shows there being no requests at all during that period (other than the initial connection requests). This was one of the durable objects I was testing during that period. I had another with the exact same usage graph.
No description

In production, when a client disconnects

In production, when a client disconnects it shows a Canceled Error even if the WebSocket is closed properly with a socket.close() from the browser when the window closes. Is there a way to prevent the errors from being thrown for normal behavior? Everything works fine and no errors are thrown locally. Everything in the Worker is already in a try/catch. Thank you! This question I asked in this thread here but I have not received a reply so maybe others will see the question. https://discord.com/channels/595317990191398933/773219443911819284/threads/1277864290296135711...

Thank you Cloudflare. I have been using

Thank you Cloudflare. I have been using WebSockets since 2012 but you made my dreams come true this week with Hibernating WebSockets. Wowza. 💯

Also are you using hibernation or the

Also are you using hibernation or the normal ws API?

What is the best way to log stuff using

What is the best way to log stuff using cloudflare, is it using baselime and if so are console.logs captured by baselime?

hey all, have a q regarding DO eviction

hey all, have a q regarding DO eviction. is it true that DO lives at least 30 seconds? (I understand there could be edge cases like DO redeploy, I but I mean a normal scenarios) Basically I want to store some data, which I want to live at least 30 seconds and at maximum 90 seconds. So I’m thinking not to store it in the storage but to rely on eviction mechanics, to not bother with storage cleaning or there’s no guarantees and DO can be evicted even after 10 seconds of inactivity?...
Next