Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 2.89 KB

README.md

File metadata and controls

49 lines (35 loc) · 2.89 KB

vercel-cron

NPM Downloads Mutation testing badge GitHub commit activity (branch) GitHub Repo stars GitHub contributors GitHub issues by-label Minified Size License

GitHub Sponsors

Vercel Crons for local development

Getting Started

npm install --save-dev vercel-cron
npx vercel-cron
# See the other options!
npx vercel-cron --help

Crons will be loaded from your vercel.json and ping localhost:3000! Your config will be watched and reloaded on changes, so there's no need to restart.

process.env.CRON_SECRET will be used to secure your cron jobs. You don't need to provide this any differently than you would next dev: we're loading your environment variables the same way that next does.

Running alongside server

My favorite is concurrently, but there are many libraries that do this.

package.json

{
  "scripts": {
    "dev": "concurrently npm:dev:*",
    "dev:cron": "vercel-cron",
    "dev:next": "next dev"
  }
}

Differences from Vercel

Cron Expressions

Under the covers, we're using croner, which has slightly different cron expressions than vercel does. Until we can find an exact validation method, vercel's suggestion is to validate expressions against crontab guru.