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

    HardAtWork

    02/10/2023, 7:09 PM
    It should? It worked for me in the browser.
  • h

    HardAtWork

    02/10/2023, 7:09 PM
    Copy code
    ts
    get<T = unknown>(
      keys: string[],
      options?: DurableObjectGetOptions
    )
    ```returns```ts
    Promise<Map<string, T>>
  • s

    sathoro

    02/10/2023, 7:10 PM
  • h

    HardAtWork

    02/10/2023, 7:12 PM
    Oh wait, it's a map...
  • h

    HardAtWork

    02/10/2023, 7:12 PM
    Darn
  • h

    HardAtWork

    02/10/2023, 7:12 PM
    Hold on...
  • h

    HardAtWork

    02/10/2023, 7:12 PM
    Yeah then, nevermind...
  • c

    ckoeninger

    02/10/2023, 7:27 PM
    Looking
  • c

    ckoeninger

    02/10/2023, 7:36 PM
    sent you a DM request
  • l

    Larry

    02/11/2023, 3:37 AM
    I have had the same problem and have asked this question several times on the pages channels and never get a complete example. If someone has this working, please help @frankichiro and me out. 🙂
  • f

    frankichiro

    02/11/2023, 8:06 AM
    Yes, please help with this. This is the only thing right now that prevents me from having a complete local development workflow for Cloudflare. It's slowing down development a lot to not be able to test my Durable Objects properly before publishing.
  • h

    HardAtWork

    02/11/2023, 8:15 AM
    You tried this? > An external Durable Object can be referenced using `wrangler pages dev ./public --do MyDO=MyDurableObject@api `where the Durable Object is made available on
    env.MyDO
    , and is described in a Workers service
    (name = "api")
    with the class name
    MyDurableObject
    . > > You must have the `api `Workers service running in as another
    wrangler dev
    process elsewhere already in order to reference that object. - Greg Brimble on Github https://github.com/cloudflare/workers-sdk/pull/1641
  • f

    frankichiro

    02/11/2023, 8:37 AM
    Ok, I just tested this and it does not work. The
    @api
    part removed the message about the DO not being found, but the DO does not show up in the
    context.env
    variable in my Pages function. I have my Worker running in a separate process and it lists my DO as an active binding.
  • s

    sathoro

    02/11/2023, 8:43 AM
    isn't it just found to the
    env
    variable without a
    context
    ?
  • h

    HardAtWork

    02/11/2023, 8:46 AM
    Not on Pages
  • f

    frankichiro

    02/11/2023, 8:53 AM
    Is this considered a bug then?
  • h

    HardAtWork

    02/11/2023, 8:55 AM
    No, just got it working, with a fresh start. Want me to make a repo?
  • f

    frankichiro

    02/11/2023, 8:55 AM
    Yes please!
  • h

    HardAtWork

    02/11/2023, 8:55 AM
    Or at least, it should work.
  • f

    frankichiro

    02/11/2023, 8:56 AM
    Good, because I am not seeing what I'm missing here.
  • h

    HardAtWork

    02/11/2023, 8:56 AM
    https://github.com/helloimalastair/PagesDebug
  • f

    frankichiro

    02/11/2023, 8:57 AM
    Thanks! I'll investigate 🙂
  • h

    HardAtWork

    02/11/2023, 8:57 AM
    Running
    Copy code
    wrangler dev --local
    ```and
    wrangler pages dev ./public --do MyDO=MyDurableObject@api ```
  • f

    frankichiro

    02/11/2023, 9:17 AM
    Ok, your example works for me too, so it seems to be something else on my end that is misconfigured. I will try to find the issue. Meanwhile, thanks a lot for your help!
  • h

    HardAtWork

    02/11/2023, 9:26 AM
    No problem, happy to help! Also, @Larry, does this fix your issue?
  • f

    frankichiro

    02/11/2023, 9:53 AM
    Hey, I found the problem. I was simply using
    wrangler dev
    instead of
    wrangler dev --local
    and this made all the difference.
  • h

    HardAtWork

    02/11/2023, 10:04 AM
    Oh yeah, the dev server has to be local, as otherwise it isn't in the
    wrangler
    registry.
  • j

    johtso

    02/11/2023, 2:21 PM
    I'm confused as to why this blog post says I can just put a DO class in a durable_objects directory in my Pages project, but the documentation says something about needing a separate worker.. https://blog.cloudflare.com/building-full-stack-with-pages/
  • s

    Skye

    02/11/2023, 2:24 PM
    Looks like that blog post is incorrect
  • j

    johtso

    02/11/2023, 2:24 PM
    Also what about this "advanced mode" that I've seen talked about, where you define your pages worker explicitly instead of using the functions directory with the built in routing functionality, which supposedly lets you export your DO class directly
1...496497498...567Latest