I have the weirdest situation going right now... - I got a DO created inside a mini worker wrapper w

I have the weirdest situation going right now... - I got a DO created inside a mini worker wrapper which is inside a larger Pages project (which sucks for DX, but I digress). - After noticing that none of the DO features were working locally for some reason, I went on the mini worker and deployed it with wrangler deploy to the correct account. - Even after deploying it, I'm (apparently?) still not able to use the DO... and the requests are 0, despite the bindings being successful (in dev.). - After this frustration, I decided to deploy to a preview environment, but because we are forced to use the build system version 1 (which doesn't support wrangler.toml), I knew I had to manually bind the DO on the dashboard. - Then, to my surprise, the DO's namespace isn't listed among the many other namespaces we have (of other projects). I've triple-checked and it's simply not there, despite it existing on the DO dashboard :shrugg: Any help is appreciated...
16 Replies
lin
lin2mo ago
I purchased a Paid plan. but How to use Durable Objects, I couldn't find the creation entry?
No description
No description
Chaika
Chaika2mo ago
not created from the dash, created from the wrangler cli attached to a worker, there's more info on the get started guide: https://developers.cloudflare.com/durable-objects/get-started/
Cloudflare Docs
Get started · Cloudflare Durable Objects docs
This guide will instruct you through:
lin
lin2mo ago
ok, Thanks!
Chinoman10
Chinoman102mo ago
What can cause a DO that's present on the dashboard to not appear under the 'Durable Object bindings' menu (under Pages > Settings > Functions)? I have this issue with exactly one DO... which is ironically the one I need.
Elyo
Elyo2mo ago
Hi everyone I can't get any error messages. I am trying to get my Durable Object working with Hono. My route
route.get("/ws/:id", ...myController.getAllWS);
route.get("/ws/:id", ...myController.getAllWS);
My controller
export const getAllWS = factory.createHandlers(
durableObjectMiddleware,
upgradeWebSocket(async (c) => {
return await c.get("stub").fetch(c.req.raw);
}),
);
export const getAllWS = factory.createHandlers(
durableObjectMiddleware,
upgradeWebSocket(async (c) => {
return await c.get("stub").fetch(c.req.raw);
}),
);
My middleware:
export default async function durableObjectMiddleware(
c: Context,
next: Function,
) {
const id = c.env.WEBSOCKET_MANAGER.idFromName("global");
const stub = c.env.WEBSOCKET_MANAGER.get(id);
c.set("stub", stub);
await next();
}
export default async function durableObjectMiddleware(
c: Context,
next: Function,
) {
const id = c.env.WEBSOCKET_MANAGER.idFromName("global");
const stub = c.env.WEBSOCKET_MANAGER.get(id);
c.set("stub", stub);
await next();
}
The Durable Object is exactly the code from Cloudflare https://developers.cloudflare.com/durable-objects/examples/websocket-hibernation-server/ In my Cloudflare dashboard, I can see the DO created. I can connect to the websocket, but no message can be send/receive in the websocket. webSocketMessage is never ever triggered, but if i close webSocketClose it does get triggered. I am clueless... The expected result is to receive my message back
Cloudflare Docs
Build a WebSocket server with WebSocket Hibernation · Cloudflare Du...
This example is similar to the Build a WebSocket server example, but uses the WebSocket Hibernation API. The WebSocket Hibernation API should be …
Jacob Marshall
Jacob Marshall2mo ago
Is there any way to view durable object instances, and browse the storage (for example) from within the dashboard? Or perhaps any third party tools that provide a similar thing?
npmansa
npmansa2mo ago
Great question, we are wondering the same! Our plan is to hook them up to telemetry with some very clear lifecycle tracking for each so we can spot bugs/problems at scale but the more visual debugging & overview tools available in the box, the better.
Ben
Ben2mo ago
Hey so I notice, I have a somewhat long promise (bunch of db calls), and I tried to do a promise.all on 10 of them, but they just never return for some reason.... causing timeouts on the db transaction. However when I make the chunksize like 5, everything works Are durable objects very resource limited or is there something else going on? is there something I can do to fix this?
Jacob Marshall
Jacob Marshall2mo ago
Cloudflare Docs
Limits · Cloudflare Workers docs
Cloudflare Workers plan and platform limits.
Chinoman10
Chinoman102mo ago
Perhaps you can think of aggregating them into SQL transactions, in order to reduze the number of outgoing requests? I still need help with my issue tho :salute_sob: would appreciate any ideas from someone...
Ben
Ben2mo ago
yep... seems like it thanks!!! Appreciate it, yea I am thinking of reorganizing my sql statements to make it so I can reduce the number of outgoing requests another question, I am using the alarm api to make a "poller". Do I have to use the "waitUntil" api to make sure the durable object doesn't die halfway through the poll, or can I assume that the DO will stay along while executing the alarm function (which can take up to 30seconds to complete)
Chinoman10
Chinoman102mo ago
I'd use the waitUntil just in case. Just be aware that if you use it, you can't 'await' the request (it'll move on and continue with whatever other code it has).
Ben
Ben2mo ago
interesting. Thanks!
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server