#@astro/cloudflare durable objects

4 messages · Page 1 of 1 (latest)

gleaming wren
#

I have my blog running on cloudflare workers + astro.

Now I wanted to use durable objects in one of my server rendered endpoints - and according to the @astro/cloudflare documentation, I should be defining a worker entrypoint like so in the adapter's config:

    workerEntryPoint: {
      path: 'src/worker.ts',
      namedExports: ['MyDurableObject'],
    },

and it gives an example of exactly this on the same page.

So I did that, and I also added this to my wrangler.jsonc:

  "durable_objects": {
    "bindings": [
      {
        "name": "MY_DURABLE_OBJECT",
        "class_name": "MyDurableObject",
      },
    ],
  },

However, when i start the dev server, I get this error:

@arnorhs/astro:dev: workerd/server/server.c++:1955: warning: A DurableObjectNamespace in the config referenced the class "MyDurableObject", but no such Durable Object class is exported from the worker. Please make sure the class name matches, it is exported, and the class extends 'DurableObject'. Attempts to call to this Durable Object class will fail at runtime, but historically this was not a startup-time error. Future versions of workerd may make this a startup-time error.
Docs

Learn how to use the @astrojs/cloudflare adapter to deploy your Astro project.

undone star
#

What does your worker.ts file
Look like?

ruby cloud
#

Were you able to figure this out?

#

I'm getting the same issues