Have to manually set up triggers in Cloudflare worker settings to run the scheduled tasks
I tried to run a scheduled task in an nuxt app by following this doc.
Here is the config:
export default defineNuxtConfig({
nitro: {
preset: 'cloudflare-module',
experimental: {
tasks: true
},
cloudflare: {
deployConfig: true,
wrangler: {
triggers: {
crons: ['* * * * *']
},
}
},
scheduledTasks: {
'* * * * *': ['some-task']
}
},
})
Env: Nuxt 3.17.3 with Nitro 2.11.12
After deploying with NuxtHub, I had to go to Cloudflare and set up the exact same trigger in the settings to make the task work. Not a big deal, just sharing in case someone else runs into the same issue.
Have you found a way to fix this directly in nuxt with nuxthub without having to put create them manually in cloudflare interface? @agalloch21
Have you found a way to fix this directly in nuxt with nuxthub without having to put create them manually in cloudflare interface? @agalloch21
Nope. But creating a new worker directly in cloudflare and linking it with the nuxt repo on github can do the trick.