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

    helio

    09/06/2021, 4:31 PM
    Like, one server replying for all requests?
  • a

    aa

    09/06/2021, 4:31 PM
    yep.
  • a

    aa

    09/06/2021, 4:31 PM
    a wee baby server.
  • a

    aa

    09/06/2021, 4:54 PM
    Is there any trick to debugging in production? miniflare is awesome for getting something running, but now that I publish i get totally useless "internal error" in the logs with no extra information
  • j

    James

    09/06/2021, 4:58 PM
    wrangler tail
    has some support for Durable Objects, so depending on exactly what error you're getting, it may yield some insight.
  • a

    aa

    09/06/2021, 5:00 PM
    Got it. The trick is to wrap everything in try/catch and manually dump it to the log. Grump.
  • m

    MrBBot

    09/06/2021, 5:11 PM
    When you find the error could you let me know what it was? Miniflare should probably throw a similar one... 👀
  • a

    aa

    09/06/2021, 5:12 PM
    Yeah I have it. It is:
    CompileError: WebAssembly.compile(): Wasm code generation disallowed by embedder
  • a

    aa

    09/06/2021, 5:12 PM
    workers support wasm, but you have to upload it statically.
  • a

    aa

    09/06/2021, 5:13 PM
    which is bummers for me.
  • a

    aa

    09/06/2021, 5:13 PM
    I'm not sure how your impl works, but if you are embedding v8, the relevant api is: https://bugs.chromium.org/p/v8/issues/detail?id=6756
  • m

    MrBBot

    09/06/2021, 5:14 PM
    ah, got it, I probably just need to set
    wasm: false
    here: https://github.com/mrbbot/miniflare/blob/master/src/scripts.ts#L17 (https://nodejs.org/api/vm.html#vm_vm_createcontext_contextobject_options)
  • a

    aa

    09/06/2021, 5:44 PM
    is there a way to know what pop i'm in? both for the outer worker and the DO ?
  • a

    aa

    09/06/2021, 5:44 PM
    The latency is higher than I expect. I feel like when I tested this before I was getting absurdly low latency like 10ms, now its 100.
  • a

    aa

    09/06/2021, 5:47 PM
    nevermind, found request.cf
  • r

    raRaRa

    09/06/2021, 5:53 PM
    For me, it's a great use case for creating an instance of a room where state and real-time magic needs to happen. For instance my online pictionary prototype skissan.com uses DO instance for each room, and a single DO instance for the lobby
  • i

    ItsWendell

    09/06/2021, 9:15 PM
    @User https://latencies.codesurge.workers.dev/ping
  • i

    ItsWendell

    09/06/2021, 9:15 PM
    ^ this should tell you 'from' is the worker, 'to' is the durable object.
  • i

    ItsWendell

    09/06/2021, 9:17 PM
    Anyone any tips to have a global setInterval in the durable object that I can actually stop? I get the following error:
    Copy code
    Cannot clear a timeout created in a different request context.
  • r

    raRaRa

    09/06/2021, 9:27 PM
  • i

    ItsWendell

    09/06/2021, 9:27 PM
    Yeah thanks was just looking at this 😄
  • r

    raRaRa

    09/06/2021, 9:28 PM
    Sorry on my phone, couldn't link to it
  • i

    ItsWendell

    09/06/2021, 9:28 PM
    No worries, thanks 😄
  • i

    ItsWendell

    09/06/2021, 9:28 PM
    It's too bad we can't clear these though 🤔
  • i

    ItsWendell

    09/06/2021, 9:29 PM
    I guess with an setInterval implementation using setTimeout, I can just stop the next setTimeout. I'll try that.
  • r

    raRaRa

    09/06/2021, 9:29 PM
    Yeah it sounds like it's something that will be fixed
  • v

    Vanessa🦩

    09/06/2021, 9:30 PM
    That's what I do, yes.
  • v

    Vanessa🦩

    09/06/2021, 9:33 PM
    Maybe I should add setInterval to my workaround gist? It appears to be quite popular 😅
  • r

    raRaRa

    09/06/2021, 9:35 PM
    Definitely 🙂
  • r

    raRaRa

    09/06/2021, 9:35 PM
    I attempted to look for it for fun, but no luck!
1...173174175...567Latest