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

    PhilipA

    03/16/2021, 10:34 PM
    Can someone on the CF team give the official answer as to the relationship between CPU time and websockets on DO? For example, if a websocket connection is sending some sort heartbeat request to a DO, and that DO is doing some CPU work to handle them (say 1ms per request), is that websocket connection getting dropped after 50 of those heartbeat requests?
  • v

    vans163

    03/16/2021, 10:35 PM
    oh so this allows a worker to connect to another websocket endpoint? (say a nonworker like wss://echo.websocket.org)
  • c

    Ceru ©

    03/16/2021, 10:35 PM
    Yes
  • v

    vans163

    03/16/2021, 10:35 PM
    very interesting usecase
  • c

    Ceru ©

    03/16/2021, 10:35 PM
    It allows you to connect to any web socket server
  • c

    Ceru ©

    03/16/2021, 10:36 PM
    I would recommend cfw-easy-utils to make it easier
  • v

    vans163

    03/16/2021, 10:36 PM
    so many ideas in my head wow this opens up so many possibilties
  • v

    vans163

    03/16/2021, 10:37 PM
    like this makes it possible to setup a NoVNC proxy + auth without jumping thru 3 hoops
  • t

    ttraenkler

    03/18/2021, 6:52 AM
    i have applied for the closed beta and was promised an update on the status in the queue in january but no message since then. so i am waiting for the beta to open to the public. is the plan for the public beta still q1?
  • a

    albert-zhao

    03/18/2021, 6:54 AM
    hey, sorry for the missing follow-up. Yes, the team is hoping to open up the beta very soon
  • t

    ttraenkler

    03/18/2021, 6:55 AM
    thanks! very soon being still in q1 tentatively?
  • a

    albert-zhao

    03/18/2021, 6:56 AM
    Tentatively, yeah 🙂
  • t

    ttraenkler

    03/18/2021, 6:57 AM
    thanks, so there is still hope 🤡
  • k

    Kat

    03/18/2021, 1:28 PM
    Excited to try out Durable Objects 😃
  • j

    jed

    03/19/2021, 2:07 AM
    I had a bit of a tough time yesterday debugging this: 1. Worker receives request, calls a DO stub. 2. DO returns a 302 with a Location header containing a fully-qualified URL pointing to a different host. 3. Worker receives the response, but ignores the host of the Location and fetches from the DO again (ie, the stub's
    fetch
    is used, not the worker's global
    fetch
    ). 4. Since the redirect was not intended for the DO, it barfs and returns an error. Thanks to Cloudflare following the standard fetch implementation (seriously, such a good design decision), I realized I could get around this by setting the
    redirect
    property on the
    init
    parameter to
    manual
    (instead of the default
    follow
    ), but I wonder if it would be better to change the behavior of DO stub fetch to default to
    manual
    for fully-qualified 3xx Location headers that don't match the request host?
  • j

    jed

    03/19/2021, 2:25 AM
    FWIW, this kind of issue is why I think it would make sense for Cloudflare to take DO routing magic out of special runtime stubs, and assign DOs their own URIs reachable through existing
    fetch
    . It would avoid issues like this, and obviate the need for the current awkward binding setup dance.
  • n

    ndry

    03/19/2021, 11:16 AM
    Hello! I am stuck with a bunch of workers that return
    Copy code
    errors: { "code": 10013, "message": "workers.api.error.unknown" }
    when I try to delete them. I had a suspicious issue before that, but I am not sure about the relation. I was working on a script to upload workers-chat-demo and was creating both namespaces in parallel queries. Sometimes it would fail (and that's how I guessed parallel namespace creation might be an issue), but not always. When it did not fail, the chat was deployed, and the worker served the front-end, but for some of that workers the durable object namespace was not bound. Now I try to clean everything up but cannot delete those worker scripts that were deployed without errors but did not work.
  • w

    Walshy | Pages

    03/19/2021, 11:31 AM
    https://github.com/cloudflare/wrangler/issues/1415
  • n

    ndry

    03/19/2021, 12:23 PM
    Hmm, I also get
    Copy code
    500 Internal Server Error
    when requesting bindings API endpoint for those scripts I cannot delete.
  • n

    ndry

    03/19/2021, 12:34 PM
    Thanks, that indeed was one of a few links google could offer me. Unfortunately, it did not help a lot, those cases look different. Also, my issue is not wrangler related, as I do not even use it.
  • o

    oleksandr

    03/20/2021, 5:40 PM
    yeah I believe it's best to ask @User about undeletable workers scripts
  • k

    kenton

    03/20/2021, 6:13 PM
    The problem is if durable objects exist in the same URL namespace as the public internet, the SSRF becomes possible -- if you get a URL from an untrusted third party, you can't safely fetch it without first verifying that it doesn't specify one of your internal addresses.
  • k

    kenton

    03/20/2021, 6:14 PM
    Actually, the same problem exists with regards to origin fetches today, since
    fetch()
    to your same zone bypassed cloudflare and other workers. We plan to fix that by requiring you to write something like
    origin.fetch()
    to explicitly go to origin, and then global
    fetch()
    will go to the public internet always (possibly looping back into your site's "front door").
  • k

    kenton

    03/20/2021, 6:14 PM
    the issue with redirects is an interesting one that I hadn't thought about, though.
  • j

    jed

    03/22/2021, 12:41 AM
    to clarify, i'm not suggesting that DOs need to be internet-addressable, only that existing URL semantics can be used for addressing, such as by using the currently ignored hostname (ie,
    fake-host
    ) to specify the DO from inside a worker.
  • k

    kenton

    03/22/2021, 1:46 AM
    Right. But if you use the same
    fetch()
    method to address durable objects and the public internet, and the difference is determined only by URL, then SSRF becomes an issue, even if they aren't publicly addressable. To be fair, basically all other cloud platforms have this problem... but I'm hoping Workers can avoid it. 🙂
  • j

    jed

    03/22/2021, 1:55 AM
    interesting... but the threat model here requires fetching arbitrary URLs?
  • k

    kenton

    03/22/2021, 2:25 AM
    Right. But that's a common thing to want to do -- evidenced by SSRF being a common vulnerability.
  • j

    jed

    03/22/2021, 2:28 AM
    heh, i guess
    this.env[someRandomString].get(id).fetch(request)
    is a more obvious smell then. 🙇
  • k

    kenton

    03/22/2021, 2:31 AM
    there's definitely some amount of opinion and design taste here... but I'm really interested to try the "always be explicit if you don't intend to fetch from the public internet" approach. If people generally get it and it solves SSRF, awesome. If people find it cumbersome, we can always try something else.
1...293031...567Latest