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

    hanpolo

    05/10/2023, 9:59 PM
    ok .. thanks for confirming this ... appreciate it
  • l

    LordHaywood

    05/10/2023, 11:22 PM
    How fast is DO, and can they be shared between workers?
  • u

    Unsmart | Tech debt

    05/10/2023, 11:25 PM
    It depends, and yes you can bind them to any worker.
  • d

    dave

    05/11/2023, 3:11 PM
    If I create a new DO, will it always be in the exact same data centre as the Worker that created it? (Or can it end up being created elsewhere?) Basically wondering if the latency between the Worker and fresh DO will always be the same, or if I have to account for possible differences.
  • u

    Unsmart | Tech debt

    05/11/2023, 3:13 PM
    not all DCs run DOs so it can be different
  • d

    dave

    05/11/2023, 3:16 PM
    Ahh. Hmm..
  • c

    Chaika

    05/11/2023, 3:21 PM
    if you're curious where they do
  • c

    Chaika

    05/11/2023, 3:22 PM
    Even in colos that do support them, there's no absolute guarantee they will be in the same one, maintenance events and such I believe can re-route (ex. look at Chicago on that site)
  • s

    sathoro

    05/11/2023, 3:57 PM
    they can also move to different machines - although does that always occur within the same DC?
  • s

    sathoro

    05/11/2023, 3:57 PM
    cannot access storage because object has moved to a different machine
  • s

    sathoro

    05/11/2023, 3:57 PM
    ^ error in prod last night 🙂
  • s

    sathoro

    05/11/2023, 3:59 PM
    every time I think we have encountered every intermittent DO error we get another
  • u

    Unsmart | Tech debt

    05/11/2023, 4:00 PM
    They dont switch colos afaik but I think within the same colo it can switch datacenters
  • s

    sathoro

    05/11/2023, 4:00 PM
    Copy code
    js
    [
      'durable object storage operation exceeded timeout which caused object to be reset.',
      'cannot access storage because object has moved to a different machine',
      'network connection lost.',
      'cannot resolve durable object due to transient issue on remote node.',
      'durable object reset because its code was updated.',
      'the durable object\'s code has been updated, this version can no longer access storage.'
    ]
    am I missing any?
  • u

    Unsmart | Tech debt

    05/11/2023, 4:00 PM
    yes, but couldnt tell you all the error messages
  • s

    sathoro

    05/11/2023, 4:03 PM
    I found more: Durable object storage operation failed due to insufficient permissions or quota limits. A network partition caused the durable object to become unavailable. Durable object was deleted due to expiration or manual deletion. Durable object was evicted from memory due to memory pressure. Object state was corrupted due to a bug in the application code. Durable object operation failed due to a bug in the Cloudflare platform. Durable object was terminated due to a security violation or policy violation. *edit: this was a joke, I generated these with GPT
  • u

    Unsmart | Tech debt

    05/11/2023, 4:04 PM
    Youre pretty much never going to have every single error message what are you even trying to do?
  • u

    Unsmart | Tech debt

    05/11/2023, 4:04 PM
    Error messages also can change so you really shouldnt base stuff off of them
  • s

    sathoro

    05/11/2023, 4:04 PM
    yes I know it isn't great practice but I don't want other coding errors to accidentally set off a bunch of retrying logic in production
  • s

    sathoro

    05/11/2023, 4:04 PM
    if there is a more reliable way to catch them let me know
  • s

    sathoro

    05/11/2023, 4:06 PM
    > what are you even trying to do? avoid the thousands of intermittent errors we were getting in prod without going too broad and accidentally screwing ourselves with retries 🤣
  • u

    Unsmart | Tech debt

    05/11/2023, 4:07 PM
    I would just always retry 🤷
  • s

    sathoro

    05/11/2023, 4:08 PM
    we do enough retrying on other layers of our app that if this catches even just 99% of the intermittent errors it will be good enough
  • s

    sathoro

    05/11/2023, 4:09 PM
    I should consider packaging up the DO queue I built - it is working well for us in prod
  • k

    krondor

    05/11/2023, 9:42 PM
    Hi, I am trying to implement a metering solution for a product I'm building with Workers -- I need to be able to quickly see how much data a user is putting in an R2 bucket so that I can bill them for it / display that data to them. I came across this example of how to do this with Durable objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/#example---counter Have people had success with something like this? Or are there better solutions? Thanks!
  • d

    dave

    05/12/2023, 12:05 AM
    You could just create a R2 bucket for each user. 🙂
  • a

    apuchitnis

    05/12/2023, 4:10 AM
    hey @cg! curious how you got fuse.js to work in workers -- I'm struggling with it. I get the error
    Uncaught ReferenceError: process is not defined
    every time I try and do the upload 😦
  • a

    apuchitnis

    05/12/2023, 5:35 AM
    ah I figured it out -- was an issue with the file which was importing fuse.js. that file was also importing other dependencies, that included process 🙂
  • s

    sathoro

    05/12/2023, 7:04 AM
    let's say I have a DO object stub, eg
    const myStub = MY_DO.get(id)
    . and I call
    myStub.foo()
    but I get the error
    cannot access storage because object has moved to a different machine
    . do I need to create the stub again or could I just retry the
    myStub.foo()
    ?
  • s

    sathoro

    05/12/2023, 7:19 AM
    also, I'm trying to figure out what is causing
    Network connection lost.
    , we get it on around .001% of prod requests. it seems to happen on even simple routes that do nothing besides fetch a DO and return it even though we now do retrying for our DOs fetch calls
1...551552553...567Latest