durable objects + pages

Nope. Still occassionally forget to republish before a CI run. Do you have an approach that you are happy with or are you in the same boat as me?
4 Replies
johtso
johtso3y ago
No, I'm currently just researching how everything fits together. Still pretty confused about how DOs work with Pages. I see that I can bind a DO to a Pages site through the web interface (I guess that's the only way as there's no wrangler.toml?). But it sounds like I can't deploy it with Pages. In that case, can I deploy the DO completely standalone and access it from / bind it to my Pages site? Or do I have to define a worker that also exports my DO.. even though I don't need another worker I just want to access it from my Pages worker @larry.mac some discussion here https://discord.com/channels/595317990191398933/799437470004412476/1079165913649139853
Larry
LarryOP3y ago
Yes, you can deploy your DOs separately. When doing local development, with the right setup, you get hot reload when you make any changes to your code on either the pages or the DO side, but once you push to GitHub which triggers an update to the Pages side online, you have to remember to also "publish" your DOs. You wrote, "do I have to define a worker that also exports my DO.. even though I don't need another worker I just want to access it from my Pages worker". Yes, DOs are tied to workers but your worker can be completely empty export default {} I just finished reading the thread you posted. I'm going down the versioning path right now. I should have a nicely reusable approach to that before long.
johtso
johtso3y ago
if you're careful with your changes and use versioning if necessary you could just setup a github action to deploy
Larry
LarryOP3y ago
That's the direction I'm headed down. The being careful part worries me though.

Did you find this page helpful?