this is what we've got 😓 : https://

this is what we've got 😓 : https://github.com/cloudflare/next-on-pages/tree/main/internal-packages/next-dev#next-on-pages-next-dev it briefly mentions DOs but that's acutally not too too helpful I'm afraid.... I'll add a note here: https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy to better explain how to access DOs using getPlatformProxy (and we do defer to that page in our docs) Anyways to use DOs you need to define them in your wrangler.toml file in this way:
[[durable_objects.bindings]]
name = "MY_DO"
script_name = "do-worker"
class_name = "DurableObjectClass"
[[durable_objects.bindings]]
name = "MY_DO"
script_name = "do-worker"
class_name = "DurableObjectClass"
and then before you run your next-on-pages app, in a separate terminal you need to spin up your "do-worker" worker (you can't define a DO in your next-on-pages app but use the DO from a different worker) I hope this helps, please let me know if it does 🙂
2 Replies
luna
luna•10mo ago
is there any chance on DO workers being added within next instead of needing two projects?
Dario
DarioOP•10mo ago
DOs can't currently be used in a single Cloudflare Pages project (which is what a next-on-pages project is) They almost certainly will be at some point due to Workers and Pages convergence: https://blog.cloudflare.com/pages-and-workers-are-converging-into-one-experience When they are we can look into integrating them with next-on-pages (I can see some small issues but overall I don't think it would be too too problematic). So, yes for sure, but it might take a long time to get there unfortunately.... 😓
The Cloudflare Blog
The Cloudflare Blog
Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet.
Want results from more Discord servers?
Add your server