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

    HardAtWork

    09/08/2021, 7:40 PM
    Might be me completely misreading this, but would this library allow you to interact with DOs with something other than fetch?
  • l

    lukeed

    09/08/2021, 8:44 PM
    the initial entry is via
    fetch()
    but there are some abstractions in there that allow for non-
    fetch()
    communication
  • l

    lukeed

    09/08/2021, 8:44 PM
    if you wanna poke around, msg me and i'll send you the stuff
  • w

    Wallacy

    09/08/2021, 10:05 PM
    I do think that I have exactly that problem. I have two (or more) DO that need to work together!
  • w

    Wallacy

    09/08/2021, 10:09 PM
    One have the raw data, and the others have the processed data. And everytime I update one I need to update the others.
  • d

    DatSparrow

    09/09/2021, 1:09 AM
    If I perform a fetch request to a durable object from a worker, and said durable object performed a read from its storage and returns this to worker. Then would the pricing be as follows? $0.15 per million requests to worker, $0.15 per million requests to durable object, $0.20 per million requests to durable object storage (read), So for this workload it would cost $0.35 per million requests (on the durable object side) and then a further $0.15 per million requests on the worker side. I have excluded compute costs from this calculation as that is dependant on implementation. The reason I ask this is I was reading a Cloudflare blog on durable objects saying that they were cheaper than DynamoDB, but even just from the durable object side, they would work out more expensive because of the additional request cost to the durable object. The only way I see them being cheaper is repeated storage operations per durable object request? Even if you work out each durable object read storage request, that is still more expensive than DynamoDB ($0.20 durable object storage read per million, $0.15 dynamo db read per million, both 4KB) Have I missed something? Thanks.
  • e

    Erwin

    09/09/2021, 4:43 AM
    Wait what?! You promised I would get to have a look at it before you send it out to the Discord community! Don't you love me anymore? Or just the Discord community more than me?
  • l

    lukeed

    09/09/2021, 4:49 AM
    lol sorry, i still do šŸ˜› just forgot tbh. lot of names but didnt write them all down
  • l

    lukeed

    09/09/2021, 4:49 AM
    dm'ing now
  • e

    eavestreasure

    09/09/2021, 8:43 AM
    hi! Are there collections of patterns for durable objects yet? I'm trying to work out how to best convert my existing application but I realise I'm probably thinking about durable objects incorrectly.
  • e

    Erwin

    09/09/2021, 4:38 PM
    It isn’t yet super clear how you should use them, but it is pretty clear how you shouldn’t use them. And take relational database pattern is certainly not what you need. I personally like to think about them like DDD aggregates. https://martinfowler.com/bliki/DDD_Aggregate.html
  • m

    matt

    09/09/2021, 10:53 PM
    @User here's the right spot
  • m

    matt

    09/09/2021, 10:54 PM
    but yeah, I can see where your DO is with that
  • u

    unalignedant

    09/09/2021, 10:54 PM
    cheers. I'm connected to
    43fce291c00c55cba840abb1af0740c038cbf94d07976f7dd355080500a3a3dd
    and it's exhibiting the behavior described
  • m

    matt

    09/09/2021, 11:01 PM
    @User can you fetch other URLs fine?
  • m

    matt

    09/09/2021, 11:01 PM
    (from within the DO)
  • u

    unalignedant

    09/09/2021, 11:01 PM
    The DO makes another request to Discord that works as expected
  • u

    unalignedant

    09/09/2021, 11:02 PM
    I can modify it to test other endpoints if you'd like me to poke it some more
  • m

    matt

    09/09/2021, 11:04 PM
    does
    http://example.com/
    work?
  • u

    unalignedant

    09/09/2021, 11:05 PM
    This is manifesting on a service that is semi-live, I can also provide plenty more DO id's for investigation I imagine they may be in other locations? I will try requesting to
    http://example.com
    and report back in a few min.
  • m

    matt

    09/09/2021, 11:05 PM
    šŸ‘ Also interested to see if the problem goes away after you update your code
  • u

    unalignedant

    09/09/2021, 11:15 PM
    Interesting! The logs would suggest that
    http://example.com
    is failing as well. Here is what I did, and here are the resulting logs.
    Copy code
    typescript
     console.log('Requesting example dot com')
      try {
        await fetch('http://example.com')
      } catch (e) {
        // @ts-ignore
        console.log('Error fetching example.com', e.message)
        throw e
      }
     console.log('Fetched example dot com')
    Copy code
    logs": [
        {
          "message": [
            "handling queued video",
            {
              "type": "queue",
              "videoId": "Rj-m1ploAys"
            }
          ],
          "level": "log",
          "timestamp": 1631229159271
        },
        {
          "message": [
            "Requesting example dot com"
          ],
          "level": "log",
          "timestamp": 1631229159271
        },
        {
          "message": [
            "Error fetching example.com",
            "Network connection lost."
          ],
          "level": "log",
          "timestamp": 1631229205273
        }
      ]
  • u

    unalignedant

    09/09/2021, 11:16 PM
    I dont know if this is relevant or not, but this fetch is inititated after an incoming websocket message (
    websocket.addEventListener('message', () => {})
    ) to the DO, whereas the fetch that "succeeds" is part of the DO
    fetch
    handler
  • u

    unalignedant

    09/09/2021, 11:16 PM
    I am going to add a fetch to
    http://example.com
    in the
    fetch
    handler path as well, and see if it then succeeds?
  • u

    unalignedant

    09/09/2021, 11:21 PM
    Update: It fails in the
    fetch
    path as well
  • m

    matt

    09/09/2021, 11:23 PM
    is your DO opening websocket connections, acting as a client?
  • u

    unalignedant

    09/09/2021, 11:25 PM
    The DO is opening websocket connections in
    fetch()
    Copy code
    const pair = new WebSocketPair();
    const serverSocket = pair[1];
    const clientSocket = pair[0];
    returning the
    clientSocket
    in
    return new Response(null, { status: 101, webSocket: clientSocket });
  • m

    matt

    09/09/2021, 11:26 PM
    is that new, and things worked before? workers (including DOs) have a limit of 6 concurrent subrequests — I’m not sure that’s whats happening here yet, as last I recall requests over the limit would block and not return an error
  • u

    unalignedant

    09/09/2021, 11:26 PM
    This was coded up about 6 months ago and I haven't paid attention to it much. It's been working until today, in a decently high capacity. No changes were made in this script for months.
  • m

    matt

    09/09/2021, 11:31 PM
    are all of your DOs hitting this problem, or only some
1...175176177...567Latest