Cloudflare DevelopersCD
Cloudflare Developers2y ago
5 replies
jason

how to add durable object to Pages project?

I signed up for Cloudflare Workers Paid, and even logged out and back in, and redeployed by Pages project.

Based on these docs (https://developers.cloudflare.com/pages/functions/bindings/#durable-object-namespaces), I expect to see an "Add binding" button for Durable Objects, but it's not there (see screenshot).

I also tried adding a
wrangler.toml
with:
[[durable_objects.bindings]]
name = "FOO"
class_name = "Foo"

and adding my durable object's class within my project at
./durable_objects/foo.ts


No luck.

So I tried the alternate syntax, with no luck either:
durable_objects.bindings = [
  { name = "FOO", class_name = "Foo" }
]


How can I create and bind a durable object to my Pages project, when using a Workers Paid plan?
Cloudflare Docs
A binding enables your Pages Functions to interact with resources on the Cloudflare developer platform. Use bindings to integrate your Pages Functions
Bindings · Cloudflare Pages docs
Was this page helpful?