{"record":{"id":"41f544245a9392af","repo":"sveltejs/kit","slug":"warning-vercel-json-defines-cron-tasks-that-use","errorCode":null,"errorMessage":"\nWarning: vercel.json defines cron tasks that use paths that do not correspond to an API route with a GET handler (ignore this if the request is handled in your `handle` hook):","messagePattern":"\nWarning: vercel\\.json defines cron tasks that use paths that do not correspond to an API route with a GET handler \\(ignore this if the request is handled in your `handle` hook\\):","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/adapter-vercel/index.js","lineNumber":696,"sourceCode":"\tconst unmatched_paths = [];\n\n\tfor (const cron of crons) {\n\t\tif (typeof cron !== 'object' || cron === null || !('path' in cron)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst { path } = cron;\n\t\tif (typeof path !== 'string') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!valid_routes.some((route) => route.pattern.test(path))) {\n\t\t\tunmatched_paths.push(path);\n\t\t}\n\t}\n\n\tif (unmatched_paths.length) {\n\t\tbuilder.log.warn(\n\t\t\t'\\nWarning: vercel.json defines cron tasks that use paths that do not correspond to an API route with a GET handler (ignore this if the request is handled in your `handle` hook):'\n\t\t);\n\n\t\tfor (const path of unmatched_paths) {\n\t\t\tconsole.log(`    - ${path}`);\n\t\t}\n\n\t\tconsole.log('');\n\t}\n}\n\n/** @param {import('@sveltejs/kit').RouteDefinition} route */\nfunction is_prerendered(route) {\n\treturn (\n\t\troute.prerender === true ||\n\t\t(route.prerender === 'auto' && route.segments.every((segment) => !segment.dynamic))\n\t);\n}","sourceCodeStart":678,"sourceCodeEnd":714,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/adapter-vercel/index.js#L678-L714","documentation":"validate_vercel_json checks that every `crons` path in vercel.json matches an API route that has a GET handler. Cron jobs issue GET requests to the configured path; if no SvelteKit route's pattern matches the path (or it lacks a GET handler), the cron will hit a 404/405 at runtime. The adapter prints this warning listing unmatched paths, noting you can ignore it if the request is handled in your `handle` hook.","triggerScenarios":"Running adapt() with adapter-vercel when vercel.json contains `crons: [{ path: '/x' }]` and `valid_routes` (API routes with GET handlers) contains no route whose `pattern.test(path)` matches '/x'.","commonSituations":"Renaming or deleting a cron endpoint without updating vercel.json; cron path typos; handling scheduled logic purely inside the handle hook (which this check cannot see); adding crons while the endpoint lives on another deployment/domain.","solutions":["Create (or fix the path of) a +server.js route with `export async function GET()` at the cron path.","Correct the `path` in vercel.json crons to match an existing GET endpoint.","If the logic lives in your handle hook, safely ignore the warning."],"exampleFix":"// before: vercel.json -> \"crons\": [{ \"path\": \"/api/cron/daily\" }] with no such route\n// after: src/routes/api/cron/daily/+server.js\nexport async function GET() {\n  // scheduled work\n  return new Response('ok');\n}","handlingStrategy":"validation","validationCode":"const cronPaths = vercelJson.crons.map((c) => c.path);\nconst getRoutes = ['/api/cron/daily']; // routes with GET handlers\nconst unmatched = cronPaths.filter((p) => !getRoutes.includes(p));\nif (unmatched.length) console.warn(`Cron paths without GET route: ${unmatched.join(', ')}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep cron paths in sync with their +server.js GET endpoints","Update vercel.json whenever renaming or deleting endpoints","For handle-hook handling, document it so the warning can be intentionally ignored"],"tags":["vercel","adapter","cron","validation","build-warning"],"backgroundTag":"cron-path-unmatched","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}