how can I view storage.kv/_cf_KV items for remote durable objects?
how can I view storage.kv/_cf_KV items for remote durable objects?
this.env.REMOTE_DO.getByName('remote-instance-name').get_cf_KV(). If you are going to call the remote DO more times, I recommend that you two-step it and put the the remote DO stub in a variable. So:
.wrangler directory, or find the specific DO namespace folder and delete itconst x = this.ctx.storage.kv.get(”x”); // no awaitWhat I haven't heard is that I'm wrong and it's not as easy as I think, but I do wonder if that's true.I said this multiple times
idFromName from within the DO?{ name : undefined }?DurableObjectId, which is used both on the caller side of the RPC and inside the DO. In the caller side the .name will be populated correctly. The fact it's not populated inside the DO is a long-term known bug.firstDO.index() and secondDO.index() to get the list of the items. but I want to include the name of the DO in the list. Ideally it could be done within the index() function and not after..name propertysetIdentifier every time they "get" an Actor instance (which is a Durable Object) and refer to this.identifier rather than try to parse the name out of the id. It's very little code and works the same in dev and production.I'm basically using all RPC calls I thinkI hear people say this and I always wonder how users enter the system? It's got to be HTTP or WebSockets, no?
firstDO.withIdentifier('user:123').index()fetch() method for handling the websockets.fetch () and routing it that wayBindDurableObjectMiddleware is what sets the DO to c.var.notificationsthis.env.REMOTE_DO.getByName('remote-instance-name').get_cf_KV()const remoteStub = this.env.REMOTE_DO.getByName('remote-instance-name');
const remote_cf_KV = remoteStub.get_cf_KV();const remoteId = this.env.REMOTE_DO.getIdFromString('23abc...'); // 64 byte opaque hex
const remoteStub = this.env.REMOTE_DO.get(remoteId);
const remote_cf_KV = remoteStub.get_cf_KV();const x = this.ctx.storage.kv.get(”x”); // no awaitidFromNamectx: DurableObjectState { ...,
id: DurableObjectId { name: undefined }
}{ name : undefined }DurableObjectId.name.namefirstDO.index()secondDO.index()index()setIdentifierthis.identifierfirstDO.withIdentifier('user:123').index()fetch ()BindDurableObjectMiddlewarec.var.notifications {
"tag": "v3",
"deleted_classes": [
"UserCreditsObject"
],
"new_sqlite_classes": [
"UserCreditsObject"
]
}app.get("/:id", HonoAuthMiddleware, BindDurableObjectMiddleware, async (c) => {
const id = c.req.param("id");
const notification = await c.var.notifications.get(id);
if (!notification) return c.body(null, 204);
return c.json(notification);
});