https://discord.cloudflare.com logo
Join Discord
Powered by
# durable-objects
  • a

    Andy

    04/07/2021, 8:46 PM
    That's fine for right now! I'm excited about the tech and the opportunities it brings, so I'm okay with cutting myself on some rough edges!
  • d

    Deleted User

    04/08/2021, 5:12 PM
    can durable object classes extend other classes?
  • k

    Kevin W - Itty

    04/08/2021, 5:18 PM
    Yep!
  • k

    Kevin W - Itty

    04/08/2021, 5:19 PM
    I use that to abstract away virtually all the boilerplate stuff (storage persist, initialize, fetch, etc)
  • d

    Deleted User

    04/08/2021, 5:53 PM
    exactly my plans, hahah
  • t

    togmund

    04/08/2021, 6:14 PM
    Shared the magic yet?
  • k

    Kevin W - Itty

    04/08/2021, 6:15 PM
    Not yet! Got sidetracked by the great dialogue yesterday and surgery (my gf) today... I’ll be back on it while she rests!
  • t

    togmund

    04/08/2021, 6:15 PM
    Hope all is well!
  • e

    Eliot

    04/08/2021, 8:51 PM
    I've spent ages trying to figure out why I'm not able to use the
    state.storage.delete()
    method to immediately delete keys from a Durable Object. Here's the strange thing. I can see that the method is deleting keys, as it returns
    true
    for each deleted key (and
    false
    if the key didn't exist). However, when I retrieve the keys, they are still there with their values!!! Now the bizarre thing. As soon as I republish (e.g.
    wrangler publish
    ) the keys are deleted, without even making a call to the Worker! I was hoping that someone could provide some insight here. Refer to my attached Worker and durable object script.
  • e

    Eliot

    04/08/2021, 8:51 PM
    durable
  • m

    mehdiiii

    04/08/2021, 8:59 PM
    If I am reading your code right, it looks like you're deleting the keys from persistent storage but not your in-memory instance, is that right? You may need to also do something like
    delete this[key]
    (and probably validate that key before) along with your
    this.state.storage.delete(key)
  • e

    Eliot

    04/08/2021, 9:51 PM
    Oh, that makes total sense now. Thank you so much!
  • k

    Kevin W - Itty

    04/08/2021, 11:01 PM
    @mehdiiii! Glad you joined the channel! 🥳
  • k

    Kevin W - Itty

    04/08/2021, 11:02 PM
    He’s the actual genius behind why itty is so tiny (and why I’m still obsessed w proxies) - I’m just the imposter that published 😜
  • m

    mehdiiii

    04/08/2021, 11:14 PM
    not sure about "genius" but ty 😁 I've been playing with durable objects the last couple of days! really cool tech, lovely work by the team
  • k

    Kevin W - Itty

    04/08/2021, 11:45 PM
    Now scroll back up the thread and see if you can help solve the async proxy set trap dilemma
  • d

    Deleted User

    04/09/2021, 4:06 AM
    are durable objects encrypted? or would we have to do that ourselves?
  • e

    eidam | SuperSaaS

    04/09/2021, 7:54 PM
    I dont know if its DO related, but first requests from given locations are errored with
    Network connection lost.
    🤔 It seems to be happening only on routes that interacts with DO somehow
  • k

    Kevin W - Itty

    04/09/2021, 10:07 PM
    I ran similar errors the other night but didn't trace it down... which is basically to say, me too!
  • d

    Deleted User

    04/09/2021, 11:02 PM
    is there any good way to try to get a stub but only if it already exists?
  • k

    Kevin W - Itty

    04/10/2021, 2:05 AM
    I’ve been storing a log of them in KV, then checking that for existence first
  • m

    molmorg

    04/10/2021, 5:14 PM
    I'm finding some weirdness around 'this' with DurableObjects. I started from the CommonJS template and am seeing some build weirdness. Sorry if this is a JS n00b question but a few colleagues have looked at this and are also confused. Specifically in this file: https://github.com/joshtwist/SimplestWebSocketDurableObjects/blob/master/src/WebSocketDO.js The this object seems unavailable in the fetch function (blows up on this.sessions.push). Obviously, I don't instantiate this object, CF Workers runtime does. I tried changing the function to lambda but this generates a build failure. Any ideas what might be going on here?
  • m

    matt

    04/10/2021, 5:37 PM
    you have constructor misspelled, so it’s never being called (and sessions isn’t being initialized)
  • m

    molmorg

    04/10/2021, 6:01 PM
    ha ha
  • m

    molmorg

    04/10/2021, 6:01 PM
    Well, this is the walk of shame
  • v

    vans163

    04/10/2021, 8:17 PM
    Is there a way to get the DO name from inside the DO?
  • v

    vans163

    04/10/2021, 8:22 PM
    Is there a DO destructor?
  • v

    vans163

    04/10/2021, 8:22 PM
    That gets called when the DO shutsdown?
  • v

    vans163

    04/10/2021, 8:26 PM
    Is the initialPromise still needed?
  • v

    vans163

    04/10/2021, 8:26 PM
    Or the constructor can call storage.get?
1...535455...567Latest