How to run nitro task on cloudflare ?
I have deployed a site on cloudflare using nuxt hub. I have on it a task, specified to run every hour.
However I realized that task isn't triggered on production on cloudflare.
Here is my config on nuxt.config.ts :
4 Replies
If you're using a wrangler.toml, make sure the
[triggers]
section is defined. Also, check if the task was created in the Workers dashboard. The example in the documentation uses an array: '* * * * *': ['cms:update']
. https://nitro.unjs.io/guide/tasks#scheduled-tasks I'm not familiar with Nuxt Hub myself.Thank you ! I totally missed that part.
Do you have more experience on using triggers with nitro and wrangler.toml ?
I added the trigger section as follow :
[triggers]
crons = [ "0 * * * *"]
But it didn't do the trick, probably because it doesn't refer to the specified task, but I don't know the syntax.
If I remember correctly the cron times just need to match up. If there aren't any errors during build the
schedule: ...
should print out.Thanks for the feedback, didn't have any
schedule:
in the build log. I set up a cron worker on the side to trigger a webhook to replace the task for now.