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"
[[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" }
]
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
Bindings · Cloudflare Pages docs
A binding enables your Pages Functions to interact with resources on the Cloudflare developer platform. Use bindings to integrate your Pages Functions …
No description
4 Replies
Cyb3r-Jak3
Cyb3r-Jak310mo ago
Pages doesn’t use the wrangler file on deployment. You have to add them via the dashboard or API
jason
jasonOP10mo ago
Right, I was trying unsuccessfully to add it via the dashboard. That is my goal. The closest I've gotten, was to create a separate project:
npm create cloudflare@latest // choose a durable object project
npm run deploy
npm create cloudflare@latest // choose a durable object project
npm run deploy
Then my Pages project will show an "Add binding" button and let me add just this binding to my pages project. But then the code lives outside my Pages project. I'd like to get my Pages project (SvelteKit) to have access to a durable object where the class is defined inside my Pages project. Possible?
Cyb3r-Jak3
Cyb3r-Jak310mo ago
Unfortunately I believe that’s the only way durable objects can work with Pages.
jason
jasonOP10mo ago
Oof hope that's temporary because not the best dev experience Thanks for letting me know!
Want results from more Discord servers?
Add your server