NuxtN
Nuxt8mo ago
6 replies
timp

Running Nitro Tasks?

Hi,

I am looking for a way to seed my DB locally (NuxtHub SQLite, with Drizzle). I read about (experimental) Nitro Tasks (https://nitro.build/guide/tasks), which sound like a good fit.
Unfortunately, I didn't find a way to trigger Nitro tasks. Nitro tasks are not runnable via nuxi cli, just via nitro cli: npx nitro task run db:seed:test.

I created my task in server/tasks/db-seed-test.ts:

export default defineTask({
  meta: {
    name: 'db:seed:test',
    description: 'Seed test',
  },
  async run({ payload, context }) {
    // do stuff
  });
});


When I try to run the task I get the following output:

[nitro]  WARN  Please add compatibilityDate: '2025-06-12' to the config file. Using 2024-04-03 as fallback.
  More info: https://nitro.build/deploy#compatibility-date
ERROR  Failed to run task db:seed:test: Error: Missing info file: /Users/me/dev/my-project/.nitro/nitro.json (is dev server 
     running?)


Am I doing something wrong? Or is there a better way to seed my DB?
Was this page helpful?