cloudflare pages + worker definitions

Hi, I am using SvelteKit with the cloud flare adapter, and was wondering if there was a way to define a worker that will run on a cron schedule in the same wrangler file alongside the sveltekit pages? Thanks !
3 Replies
DaniFoldi
DaniFoldi8mo ago
Hi, Pages doesn't support scheduled cron workers, so you'll need to deploy a worker separately I'm afraid. A good way to still keep them in sync is to define the worker in the same repository, and run wrangler deploy on the worker in your CI where you build your pages proejct. You'll need to take care about environments (at least prerelease and prod is my recommendation) manually.
boss
bossOP8mo ago
Hey, thank you for the response! Just to clarify, I would have two different wrangler files, and in two different folders? So maybe a /pages and then /workers And if I wanted more than one worker, I would also have to split them up into different wrangler files too
onnimonni
onnimonni4mo ago
Is this still the situation today? Scheduled functions can't be called from Pages projects?
Want results from more Discord servers?
Add your server