How do I schedule a workflow to run at specific date?
Hi there! To better assist you with scheduling your workflow, could you please share any relevant code snippets, error messages, or stack traces you’re encountering? Additionally, if you have any config files, deployment logs, or steps to reproduce the issue, that would be super helpful. Excited to help! Thanks for being part of the community!
If you have a specific single time you want to run the workflow, the best way is to run it now but put a sleep at the top
import { sleep } from "workflow"
async function testWorkflow() {
"use workflow"
await sleep(new Date('2026-05-05'))
}
If you only sometimes want to schedule, you can pass it in as part of the payload
import { sleep } from "workflow"
async function testWorkflow(payload) {
"use workflow"
if (payload.scheduleAt) {
await sleep(new Date(payload.scheduleAt))
}
}
To run at a fixed interval (eg: once per day, twice per month) you can use a cron job https://vercel.com/docs/cron-jobs
This can either call start(workflow) or if you have a running workflow that you want to send events to, it can call a workflow hook
Hey there! Just checking in to see if you still need help with scheduling your workflow. If you found a solution or have any further questions, feel free to share! Excited to help!
This isn’t what I need. It would be great to schedule a workflow for a specific date. Using cron or sleep is a decent workaround, but native scheduler support would be much better.
What features are you looking for in a scheduler that are missing with a code based approach?