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

    Erwin

    11/24/2022, 10:08 PM
    Ahh.. do you terminate the WS in the Worker or the DO?
  • r

    rennokki

    11/24/2022, 10:18 PM
    Neither.
  • r

    rennokki

    11/24/2022, 10:19 PM
    It just keep polling to keep the connection alive.
  • r

    rennokki

    11/24/2022, 10:19 PM
    But the DO gets evicted because the ping-pong messages are not tied to the DO
    e
    • 2
    • 5
  • r

    rennokki

    11/24/2022, 10:19 PM
    This leads to the DO eviction but does not close the WS connection.
  • i

    ItsWendell

    11/24/2022, 11:16 PM
    Would server-sent events count as the same limits and usage as a websocket connection being open? An websocket being open would count as your DO being active and paying the maximum 128MB ram per second. Would the same be the case for a http connection being open?
  • e

    Erwin

    11/25/2022, 12:19 AM
    As long as the Durable Object is active, you will be charged.. no matter if there are 0, 1 or 100 WebSocket connections open 🙂
  • a

    arbfay

    11/25/2022, 10:48 AM
    I'd like to call a specific endpoint (
    /migrate
    , you guess what it does) for all my DOs. What's the best way to do so?
  • h

    HardAtWork

    11/25/2022, 11:08 AM
    Call the CF API, get all of the IDs, create a Worker that takes an ID, creates a stub, and calls
    /migrate
    , and then call it with all of the IDs.
  • a

    arbfay

    11/25/2022, 11:13 AM
    Thanks! Found the CF API endpoint in question: https://api.cloudflare.com/#durable-objects-namespace-list-objects
  • h

    HardAtWork

    11/25/2022, 11:14 AM
    Or https://developers.cloudflare.com/api/operations/durable-objects-namespace-list-objects, if you don't want to crash your browser 😜
  • a

    arbfay

    11/25/2022, 11:15 AM
    surprisingly it's not a
    .list()
    function in the DO namespace (any reason?)
  • h

    HardAtWork

    11/25/2022, 11:16 AM
    I believe DO's aren't globally documented, so a
    list
    would basically have to contact every DO-ready colo to collect the data
  • a

    arbfay

    11/25/2022, 11:18 AM
    mmmh but does the CF API do that?
  • h

    HardAtWork

    11/25/2022, 11:20 AM
    Yeah. I'm not saying it isn't possible, I'm just trying to explain what I think might be their reasoning behind why it isn't a native API.
  • c

    Collatz

    11/25/2022, 10:42 PM
    Hello, I have a question about DO pricing. When I was buying the Paid plan I saw the next information: "+ $12.50 per additional 400,000 GB-second duration" However, on the docs page (platform pricing) I see "+ $12.50/million GB-s". Do I need to pay 12.5$ per 1M or 400K?
  • i

    Isaac McFadyen | YYZ01

    11/25/2022, 10:46 PM
    The 400k is for Workers Unbound, not Durable Objects
  • i

    Isaac McFadyen | YYZ01

    11/25/2022, 10:46 PM
    Durable Objects pricing is indeed the 1M: https://developers.cloudflare.com/workers/platform/pricing/#durable-objects
  • u

    Unsmart | Tech debt

    11/25/2022, 10:57 PM
    Unbound and DO are both 12.50 per million GB-sec
  • c

    Collatz

    11/25/2022, 11:43 PM
    Thanks! I hope that cloudflare will fix this misunderstanding on the payment method page.
  • s

    srb

    11/25/2022, 11:43 PM
    hello, i am on a paid workers plan and do not see an option to create Durable Objects
  • c

    Collatz

    11/25/2022, 11:45 PM
    I don't see it either. But I waited for a while and an alert appeared on the workers/overview page and I clicked it.
  • i

    Isaac McFadyen | YYZ01

    11/26/2022, 12:00 AM
    Yup, I mentioned it to someone.
  • s

    srb

    11/26/2022, 12:13 AM
    i just made a new function with wrangler and added durable object to that, deployed it, and now i can select the durable object binding
  • i

    ItsWendell

    11/26/2022, 12:54 PM
    What's the general DO timeout time? Since DOs are charged for 'wall-time', when all operations are completed, how long until it is destroyed generally and a new contruct call will be done?
  • a

    aarhus

    11/26/2022, 1:52 PM
    It's wall time of the the request being completed
  • r

    Rafal

    11/26/2022, 5:27 PM
    Any suggestions what to do with
    Cannot create binding for class ChannelsDO that is not exported by the script
    ? This class is clearly exported in my file. I have also defined
    new_classes = ["ChannelsDO"]
    inside migrations. The suggested
    --new-class
    flag seems to be targeted to Wrangler 1?
  • m

    matt

    11/26/2022, 6:22 PM
    what does your durable_objects section look like? did you
    export class ChannelsDO
    inside the script
  • r

    Rafal

    11/26/2022, 6:43 PM
    Copy code
    [durable_objects]
    bindings = [  { name = "CHANNELS", class_name = "ChannelsDO" },  { name = "CHANNEL", class_name = "ChannelDO" }]
    I'm using esbuild to bundle multiple TS files into one .mjs. The compiled MJS file ends with:
    export {  ChannelDO,  ChannelsDO,  src_default as default,  handleRequest };
    where
    ChannelsDO
    is a class.
  • r

    Rafal

    11/26/2022, 6:44 PM
    main
    inside
    wrangler.toml
    is pointing to that mjs file
1...446447448...567Latest