Is it impossible to combine durable objects with workers sites?

I’m trying to connect a worker (that has a site) to a durable object.

However, Wrangler still doesn’t support durable objects, so you have to stitch together shell scripts to talk to the API to deploy DO workers. Going down that path, you eventually have to recreate the bindings that [site] creates dynamically during wrangler publish. However, the metadata.json bindings for sites seem unrealistic to write by hand (__STATIC_CONTENT + __STATIC_CONTENT_MANIFEST).

Running wrangler publish with the sites config destroys the binding to the durable object’s namespace. Running curl to /workers/scripts/$SCRIPT with a hand-written metadata.json destroys the bindings for sites.

Ideally, I’d like to run wrangler publish and then additively create the durable object bindings on the worker, so it would both be able to host a site and talk to a durable object. I haven’t yet found a way to make that possible though.

/cc @denis.truffaut since you seem to be exploring similar things.

Cheers,

Hi @hunter!

Please follow RFC: Durable Objects support · Issue #1550 · cloudflare/wrangler · GitHub

I ended up re-creating a subset of wrangler publish (including workers-site support and durable objects) in node.

It seems like a simple approach to durable object support in wrangler.toml would be to allow arbitrary bindings. Right now, you can use vars in wrangler.toml to specify certain types of bindings (like plain_text), but that’s much more limited than the bindings available through the API.