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

    koudelka

    12/26/2022, 12:26 AM
    Otherwise there is also https://www.npmjs.com/package/itty-durable
  • i

    ItalyPaleAle

    12/27/2022, 12:13 AM
    How do you back up data stored in DO (especially storage)?
  • i

    ItalyPaleAle

    12/27/2022, 12:25 AM
    (And equally important how can you do a “point-in-time” restore?)
  • z

    zegevlier

    12/27/2022, 2:18 PM
    There is currently no way to easily back up DO data. You'll have to read all the data from it and save it somewhere else manually. There is also no support for point in time restore
  • i

    ItalyPaleAle

    12/27/2022, 3:33 PM
    Thanks for confirming. The problem with performing the operation "manually" (listing all data and reading it) is that is non-atomic and could return an inconsistent view of the data. Do you know if there's something on the roadmap?
  • b

    brett

    12/27/2022, 3:41 PM
    Nothing set yet, but we should clearly offer something here... how much data are you storing in each object? If they comfortably fit in memory you could read everything into memory at a point in time, and use that snapshot to push somewhere.
  • i

    ItalyPaleAle

    12/27/2022, 3:43 PM
    Not sure about size yet, it's still in early dev phase and just exploring solutions for storing data. It probably won't be too big. Even reading everything in memory, however.... If I have multiple DOs, each with its own key, the snapshot would still not be consistent, would it?
  • b

    brett

    12/27/2022, 3:47 PM
    Ah, if you want point-in-time across objects that won't work, no. I'm not sure if we'll offer that, though. DOs can be all over the world, I'm not sure that doing consistent point-in-time across all locations is even possible or makes any real sense.
  • i

    ItalyPaleAle

    12/27/2022, 3:50 PM
    Right, that makes sense. I guess having a consistent view across all objects would not be as strict of a requirement. Could probably live without that if I design the schema correctly. But yes, some official tools to more simply back up, and especially restore, data would be very welcome.
  • d

    DanTheGoodman

    12/27/2022, 10:52 PM
    Are there any references to what the KV read/write latencies are for DOs? Like really rough (please ping)
  • h

    HardAtWork

    12/28/2022, 7:32 AM
    They should be the same as for Workers, since DOs and Workers use the same runtime. Note too that latency(on first read) changes wildly between different data centers
  • k

    koudelka

    12/28/2022, 11:57 AM
    Are there any numbers for DO storage read/write latencies?
  • d

    DanTheGoodman

    12/28/2022, 12:00 PM
    Sorry I meant for the local kv of the storage
  • h

    HardAtWork

    12/28/2022, 12:19 PM
    Oh, for DO Storage. Yeah, no hard data, but I’d say somewhere within a few ms
  • t

    tranzium

    12/28/2022, 9:11 PM
    Is there a particular way to populate the "exceptions" array of the log output? I am receiving an Exception on a Durable Object Alarm but it would help if I knew the actual error message. 🤔
  • b

    Blizzy

    12/29/2022, 12:18 AM
    I don't see Durable Objects in my Dashboard when I go to Workers. 🤷🏼‍♂️
  • j

    James

    12/29/2022, 12:25 AM
    What are you wanting to see? You can see storage in the dashboard but that's about it: https://up.jross.me/zjl9s748. And then any DO bindings for individual workers if you click into them -> settings -> variables.
  • b

    Blizzy

    12/29/2022, 12:28 AM
    I see that now. The [documentation](https://developers.cloudflare.com/workers/learning/using-durable-objects#websockets-in-durable-objects) says it's located at Workers > Durable Objects, but it's located under the Worker itself. I'm new to DOs, so it might take me a minute to understand. I'm trying to build a Chat Support Widget for my software.
  • j

    James

    12/29/2022, 12:29 AM
    Ah I see - that's only for enabling them 🙂 I don't believe that's even needed anymore, but if you're enabled, you're good to go.
  • b

    Blizzy

    12/29/2022, 1:26 AM
    @James When I try to publish this Worker from the examples, I get an error: https://github.com/cloudflare/workers-chat-demo
    Copy code
    Error: missing field `type`
    and when I try the default
    type="webpack"
    , I get a different error:
    Copy code
    👀  ./src/chat.html 1:0
    Module parse failed: Unexpected token (1:0)
    You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
    > <!DOCTYPE html>
    | <!--
    |   THIS IS NOT THE INTERESTING FILE
     @ ./src/chat.mjs 62:0-31 104:28-32
    Any insight would be helpful. TIA
  • b

    Blizzy

    12/29/2022, 1:31 AM
    When I try
    type = "javascript"
    , I get...
    Copy code
    Uncaught SyntaxError: Cannot use import statement outside a module
      at worker.js:62
    Is there like an
    ecmascript
    type or a
    module
    type?
  • j

    James

    12/29/2022, 1:33 AM
    Sounds like you’re using wrangler 1 and not wrangler 2
  • b

    Blizzy

    12/29/2022, 1:33 AM
    Ah.
  • b

    Blizzy

    12/29/2022, 1:36 AM
    Thank you. :3
  • s

    sks

    12/29/2022, 10:13 AM
    I need to understand how to use durable objects in a WebSocket fashion, directly from the front end. I understand that I need a worker first to receive the connection and then forward the websocket to the object. But what I do not undertsand is, for as long as the durable object is active and running and connected to the frontend via websocket, am I being billed for the worker too ? Is the worker still running like a normal AWS Lamda would, and do i need the worker unbound plan for this to work ?
  • s

    sks

    12/29/2022, 11:14 AM
    Is it possible to share durable objects between two different workers? I am trying to create a readable durable objects, which will be written to occasionally. So, I was thinking maybe I could use a worker for the read and another for the write.
  • d

    davidfm

    12/29/2022, 11:30 AM
    Hi all 👋 , I'm new to Durable Objects. I'm trying to use them to go through a list of urls to fetch (stored in the internal storage) via alarms: 1 alarm fetches a batch, then schedules another to fetch another and so on. I need the result of the fetch done in the
    alarm()
    handler to be stored in the Cloudflare cache. I'm already using
    fetch()
    with cache option as described in https://developers.cloudflare.com/workers/examples/cache-using-fetch/. This is working fine when done from within a regular worker, but the cache status is always
    MISS
    when the requests are done from within the
    alarm()
    handler. Does
    fetch
    with cache options work normally when invoked from
    alarm
    ? or is there any limitation o `fetch`ing with cache from DOs ? (I don't see anything mentioned in docs...) Thanks in advance, any guidance is appreciated!
  • b

    brett

    12/29/2022, 2:51 PM
    If you forward the request object to the DO and return the DO's response then the middleman Worker just becomes a simple proxy and you are no longer charged for the middleman Worker.
  • b

    brett

    12/29/2022, 2:51 PM
    Yeah, each Durable Object ID is globally unique. If 2 or 20 or 200 different Workers access the same DO by ID they will be talking to the same instance.
  • s

    sks

    12/29/2022, 2:52 PM
    By two different workers, i meant to say, two different workers on entirely different routes, or I should say, two entirely different codebases, but both are on the same account.
1...465466467...567Latest