nitro icon indicating copy to clipboard operation
nitro copied to clipboard

`scheduledTasks` + `cloudflare.deployConfig` should populate cron triggers config

Open mathix420 opened this issue 9 months ago • 4 comments

Describe the feature

What I have to do now:

export default defineNitroConfig({
  compatibilityDate: "2025-03-05",
  preset: "cloudflare_module",

  experimental: {
    tasks: true,
  },

  cloudflare: {
    deployConfig: true,
    wrangler: {
      triggers: {
        crons: ['*/15 * * * *', '45 10 * * 2-6']
      }
    }
  },

  scheduledTasks: {
    "*/15 * * * *": ["task1"],
    "45 10 * * 2-6": ["task2"],
  },
});

Expected config:

export default defineNitroConfig({
  compatibilityDate: "2025-03-05",
  preset: "cloudflare_module",

  experimental: {
    tasks: true,
  },

  cloudflare: {
    deployConfig: true,
  },

  scheduledTasks: {
    "*/15 * * * *": ["task1"],
    "45 10 * * 2-6": ["task2"],
  },
});

Additional information

  • [x] Would you be willing to help implement this feature?

mathix420 avatar Mar 11 '25 17:03 mathix420

Do the settings you have right now work on Cloudflare Workers? I followed this doc to define a task and have similar settings to yours. It works locally but doesn’t work after deployment.

agalloch21 avatar Aug 18 '25 20:08 agalloch21

Update: If i use NuxtHub to deploy the project, the scheduled task won't get called. If i deploy the project manually on Cloudflare, it works. Nuxt 3.17.3 with Nitro 2.11.12

agalloch21 avatar Aug 18 '25 21:08 agalloch21

If you can deploy nitro only to cloudflare but only hub fails, i suggest to report it in nuxt hub repo.

pi0 avatar Aug 19 '25 06:08 pi0

If you can deploy nitro only to cloudflare but only hub fails, i suggest to report it in nuxt hub repo.

Sure, sorry for the off-topic. I reported it here in case someone runs into the same issue

agalloch21 avatar Aug 19 '25 21:08 agalloch21