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

    Vanessa🦩

    06/18/2021, 10:20 PM
    I'm not currently using ArrayBuffers, but intend to. And normally
    WebSocket.send()
    accepts those, but the Cloudflare docs explicitly state
    string
    as argument. (I can just try, but the docs should be fixed too)
  • m

    maxastuart

    06/18/2021, 10:21 PM
    I have a feeling that's not a typo, I think i remember reading in the announcement blog post or some other (possibly not the main) documentation that its string-only for workers and/or DOs, at least for now
  • v

    Vanessa🦩

    06/18/2021, 10:22 PM
    Oh, interesting.
  • m

    maxastuart

    06/18/2021, 10:23 PM
    (I'm working around it right now, or nearby-around it, in that I'm trying to set a certain transport protocol for the websocket connection and validate it on the DO before further processing, and its causing a conundrum)
  • m

    maxastuart

    06/18/2021, 10:31 PM
    in fact, has anyone here (in the DO realm) dealt with
    graphql-transport-ws
    (the newer websocket protocol for graphql)?
  • g

    Greylock

    06/19/2021, 4:56 PM
    @User thats been deprecated
  • g

    Greylock

    06/19/2021, 4:56 PM
    its ``graphql-ws`` now
  • a

    albert

    06/20/2021, 11:08 AM
    Ingress to a Durable Object is free, right? Egress to Backblaze B2 is also free, right? So
    Client -> Durable Object -> Backblaze B2
    data transfer would not incur any charges, right?
  • m

    Mallissin

    06/20/2021, 4:33 PM
    You are passing data through the DO to Blackblaze? Why not just send it right to Blackblaze?
  • j

    Josh

    06/20/2021, 4:34 PM
    Bandwidth alliance + CDN Caching on CF
  • j

    Josh

    06/20/2021, 4:34 PM
    oh nvm
  • j

    Josh

    06/20/2021, 4:34 PM
    I was thinking of another convo
  • j

    Josh

    06/20/2021, 4:34 PM
    sorry
  • m

    Mallissin

    06/20/2021, 4:35 PM
    Could still be using caching but I still think storing directly is more efficient.
  • a

    albert

    06/20/2021, 5:11 PM
    so that clients don't have access to B2 tokens or upload URLs
  • m

    Mallissin

    06/20/2021, 7:29 PM
    You can't automate the creation of tokens so they only have certain permissions to specific locations? Maybe even hide the destination with a CNAME?
  • a

    albert

    06/20/2021, 7:57 PM
    Well, the issue is I can’t control what they upload in any way if I give them an upload URL. They could upload a 10TB file which would be quite expensive for me.
  • m

    Mallissin

    06/20/2021, 8:22 PM
    Can't check the storage size used by token location on a regular basis and shut off the token if it exceeds a certain amount? I know it's more work to coordinate over API's but I have a feeling most of this stuff should be done anyway.
  • s

    steranevdy

    06/21/2021, 5:22 AM
    after a durable object is created, how long it remains in the "hot" state if it stays idle
  • a

    AliHaider

    06/21/2021, 6:33 AM
    Unexpected token 'export' got this error when run worker!
  • a

    aiddun

    06/21/2021, 6:49 AM
    Is there any way to throttle on a durable object? Like if I was constantly getting mutations but only wanted to publish out changes every 100 ms or so
  • a

    albert

    06/21/2021, 1:55 PM
    Yeah, way too much work for what I'm doing. The client just needs to upload a single, large file and no more.
  • a

    albert

    06/21/2021, 1:56 PM
    I just want to know if inbound and outbound to B2 is free for Durable Objects šŸ™ƒ
  • c

    charl

    06/21/2021, 6:42 PM
    I got the same after upgrading wrangler, check your wranlger config and see if it is type = javascript, or webpack. I got the issue when starting a new webpack repo and wrangler created the config with type = javascript however added target_type = webpack I changed it back to just type = webpack and removed the target_type and works
  • w

    Wallacy

    06/22/2021, 2:08 PM
    If i serve image and video using Durable Objects (using B2 as persistent storage) i will be blocked as the term of services did explicitly said to avoid non-html content? In my case i did not plan to traffic too much, but sometime the user will need send/get few medias.
  • j

    James

    06/22/2021, 2:22 PM
    Is the content used on a webpage, or needed for the webpage? Those clauses in the TOS are primarily to prevent file-sharing sites, and abusive use of cache and things like that. If your primary usage is still for your website, I think you'll be fine. Obviously disclaimer that I'm not with Cloudflare, so I'd recommend reaching out to support and describing your use-case if you want to be sure.
  • w

    Wallacy

    06/22/2021, 2:59 PM
    Is a mobile application, and theres a video gallery inside that needs to be synced sometimes.
  • r

    rjs

    06/22/2021, 11:27 PM
    Hi! I have a
    wrangler.toml
    that looks like this:
    Copy code
    name = "classdojo-clubs-server"
    # type = "javascript" is required to use the `[build]` section
    type = "javascript"
    account_id = "my_account_id"
    zone_id = "my_zone_id"
    # route = ""
    workers_dev = true
    usage_model = "unbound"
    vars = { ENVIRONMENT = "development" }
    
    [dev]
    local_protocol="https"
    
    [build]
    command = "yarn install && yarn build"
    [build.upload]
    # The "modules" upload format is required for all projects that export a Durable Object class.
    format = "modules"
    dir = "./build"
    main = "./index.mjs"
    
    [env.production]
    vars = { ENVIRONMENT = "production" }
    
    [env.staging]
    vars = { ENVIRONMENT = "staging" }
    
    [durable_objects]
    bindings = [
        { name = "rooms", class_name = "Room" },
    ]
    When I run
    wrangler dev
    and log
    env
    from a fetch handler, it looks like:
    Copy code
    { ENVIRONMENT: "development", rooms: {} }
    …which is what I would expect. However, when I run the same on staging or production,
    env.rooms
    is undefined. Do I need to explicitly define durable objects per environment in
    wrangler.toml
    (something like
    [env.production.durable_objects]
    )? My intuition says no, but then I'm not sure why
    env.rooms
    is undefined in staging and production. Any help would be super appreciated, thank you!
  • c

    carlson

    06/22/2021, 11:34 PM
    Yes, you need to explicitly define the durable objects per environment. Got the same issue before. This is not documented yet I believe.
  • m

    maxbittker

    06/22/2021, 11:35 PM
    ohhhhhh let me try (I work with @User) - like this?
    [env.production.durable_objects]
1...105106107...567Latest