What's the proper way to set up a Durable Object that's only used by a Pages Function?
Right now, I have a setup like this:
* I have the Durable Object deployed as its own Worker.
* I have a Pages Function script with a Durable Object binding. It exports an
onRequestGet()
implementation that parses the request URL, generates the DO ID from it, and calls fetch()
on that DO's stub.
This works. But to upload the Durable Object, Wrangler makes me define a module-level fetch()
function in the DO script. As far as I can tell, that implementation is unused; the Pages Function bypasses it. So it feels like I'm doing something wrong?1 Reply
You could probably just do
export default {}
in the Worker too, rather than having the fetch
handler in the export default
block