Files
Shahed Nasser e3e3c725db docs: triage issues + revamp troubleshooting guides (#14216)
* docs: triage issues + revamp troubleshooting guides

* small change
2025-12-04 17:12:48 +02:00

52 lines
1.4 KiB
Plaintext

import NotRunning from "../_sections/scheduled-jobs/not-running.mdx"
import NotRunningWorkerMode from "../_sections/scheduled-jobs/not-running-worker-mode.mdx"
export const metadata = {
title: `Scheduled Job Not Running on Schedule`,
}
# {metadata.title}
This troubleshooting guide helps you troubleshoot issues when a scheduled job in your Medusa application is not running, or running at unexpected times.
## Confirm Job is Set Up Correctly
Make sure that the scheduled job is set up correctly in your Medusa application. Check the following:
1. The job is created under the `src/jobs` directory.
2. The job exports an asynchronous function that performs the task. For example:
```ts title="src/jobs/hello-world.ts"
import { MedusaContainer } from "@medusajs/framework/types"
export default async function greetingJob(container: MedusaContainer) {
const logger = container.resolve("logger")
logger.info("Greeting!")
}
```
3. The job exports a `config` object that has the following properties:
- `name`: A unique name for the job.
- `schedule`: A string that holds a [cron expression](https://crontab.guru/) or an `interval` indicating the schedule to run the job.
For example:
```ts title="src/jobs/hello-world.ts"
export const config = {
name: "greeting-every-minute",
schedule: "* * * * *",
}
```
---
## Job Not Running on Schedule
<NotRunning />
---
## Confirm Worker Mode is Set Up Correctly
<NotRunningWorkerMode />