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

    Vanessa🦩

    08/04/2021, 4:49 PM
    (the “via” item in the latency display is the worker colo)
  • a

    albert

    08/04/2021, 4:53 PM
    Ahh, alright - that's quite slow then, as I get 26 ms latency when running a Speedtest on the VPN. Cloudflare does peer with M247 in Amsterdam, right?
  • a

    albert

    08/04/2021, 4:56 PM
    Hmm, pinging
    1.1.1.1
    (on VPN to M247 in Amsterdam) gives me a latency of 28 ms, so perhaps the route between AMS and FRA is just slow for some reason?
  • i

    ItsWendell

    08/04/2021, 6:01 PM
    Is it possible to move an web-socket connection from the worker to a durable object?
  • v

    Vanessa🦩

    08/04/2021, 7:04 PM
    yes, you pass the websocket request (with the "Upgrade: websocket" header) to the DO via
    stub.fetch(request)
  • k

    Kuririn

    08/04/2021, 9:15 PM
    When I have durable object, let's call it xyz I must use fetch to communicate with it? or could I call it's functions directly? example: xyz.storage.get('key');
  • v

    Vanessa🦩

    08/04/2021, 9:20 PM
    Yes, fetch only
  • k

    Kuririn

    08/04/2021, 9:20 PM
    ok, thanks
  • v

    vans163

    08/05/2021, 1:54 AM
    seeing these today "Error: Internal error in Durable Object storage write caused object to be reset."
  • k

    kenton

    08/05/2021, 2:09 AM
    It looks like we have some sort of bug where some errors like this happen while we roll out an update to the workers runtime. We are looking into it. (FWIW, whenever you see "internal error" that means we think it's our bug, not yours, and the error has already been reported to our internal monitoring.)
  • a

    albert

    08/05/2021, 1:03 PM
    I need to use an NPM package in my Durable Object project - can someone tell me which of these templates would allow me to do that? Thanks! 🙂 https://github.com/cloudflare/durable-objects-template https://github.com/cloudflare/durable-objects-rollup-esm https://github.com/cloudflare/durable-objects-webpack-commonjs
  • e

    elithrar

    08/05/2021, 1:10 PM
    https://github.com/cloudflare/durable-objects-rollup-esm is (IMO) a good place to start -
  • e

    elithrar

    08/05/2021, 1:10 PM
    It even shows importing a package in the example entrypoint: https://github.com/cloudflare/durable-objects-rollup-esm/blob/master/src/index.mjs
  • a

    albert

    08/05/2021, 1:11 PM
    Alright. Thanks!
  • e

    elithrar

    08/05/2021, 1:11 PM
    (I use Rollup on my own projects, and ES Modules are the way forward, especially with Durable Objects / Workers’ Modules API)
  • i

    ItsWendell

    08/05/2021, 4:19 PM
    Is it possible to know where in the world the durable object is?
  • j

    john.spurlock

    08/05/2021, 4:32 PM
    one way is to fetch
    https://1.1.1.1/cdn-cgi/trace
    from inside the DO, and cache the colo field from that trace
  • j

    john.spurlock

    08/05/2021, 4:35 PM
    iirc module workers are now passed a
    cf
    property on each incoming fetch request, so
    request.cf.colo
    is defined for the incoming worker request, but the
    Request
    passed to your DO's
    fetch
    still does not have the
    cf
    property (I just double-checked) - it makes sense since many of the custom
    cf
    properties don't apply for the internal DO fetch calls, but a colo accessor (maybe on
    state
    ?) would certainly be useful
  • i

    ItsWendell

    08/05/2021, 4:49 PM
    Yeah having the CF property specific for the worker would be great!
  • j

    john.spurlock

    08/05/2021, 4:57 PM
    in case you haven't seen it, check out https://where.durableobjects.live/ by @jed, a cool idea to find out which cf colos support DOs at the moment
  • a

    albert

    08/05/2021, 5:43 PM
    🤔
  • a

    albert

    08/05/2021, 5:44 PM
    /cdn-cgi/trace > colo=OTP
  • j

    john.spurlock

    08/05/2021, 5:45 PM
    hehe, probably a colo he doesn
  • j

    john.spurlock

    08/05/2021, 5:45 PM
    t have his master list yet
  • a

    albert

    08/05/2021, 5:46 PM
    It's on VPN to Albania - thought I'd populate the list some more 😛
  • j

    john.spurlock

    08/05/2021, 5:47 PM
    it would be so nice to be able to send a worker request to a specific colo for testing this sort of thing
  • a

    albert

    08/05/2021, 5:47 PM
    when you loaded this page from undefined, a worker in Bucharest (OTP) created a durable object in Vienna (VIE)
  • a

    albert

    08/05/2021, 5:47 PM
    correct colo this time
  • a

    albert

    08/05/2021, 5:47 PM
    wait,
    colo=PRG
  • j

    john.spurlock

    08/05/2021, 5:47 PM
    maybe pager went off : )
1...138139140...567Latest