sveltejs/kit · warning

Warning: vercel.json defines cron tasks that use paths that

Error message

Warning: 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):

What it means

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.

Source

Thrown at packages/adapter-vercel/index.js:696

	const unmatched_paths = [];

	for (const cron of crons) {
		if (typeof cron !== 'object' || cron === null || !('path' in cron)) {
			continue;
		}

		const { path } = cron;
		if (typeof path !== 'string') {
			continue;
		}

		if (!valid_routes.some((route) => route.pattern.test(path))) {
			unmatched_paths.push(path);
		}
	}

	if (unmatched_paths.length) {
		builder.log.warn(
			'\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):'
		);

		for (const path of unmatched_paths) {
			console.log(`    - ${path}`);
		}

		console.log('');
	}
}

/** @param {import('@sveltejs/kit').RouteDefinition} route */
function is_prerendered(route) {
	return (
		route.prerender === true ||
		(route.prerender === 'auto' && route.segments.every((segment) => !segment.dynamic))
	);
}

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Create (or fix the path of) a +server.js route with `export async function GET()` at the cron path.
  2. Correct the `path` in vercel.json crons to match an existing GET endpoint.
  3. If the logic lives in your handle hook, safely ignore the warning.

Example fix

// before: vercel.json -> "crons": [{ "path": "/api/cron/daily" }] with no such route
// after: src/routes/api/cron/daily/+server.js
export async function GET() {
  // scheduled work
  return new Response('ok');
}
Defensive patterns

Strategy: validation

Validate before calling

const cronPaths = vercelJson.crons.map((c) => c.path);
const getRoutes = ['/api/cron/daily']; // routes with GET handlers
const unmatched = cronPaths.filter((p) => !getRoutes.includes(p));
if (unmatched.length) console.warn(`Cron paths without GET route: ${unmatched.join(', ')}`);

Prevention

When it happens

Trigger: 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'.

Common situations: 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.

Related errors


AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02). Data as JSON: /api/errors/41f544245a9392af. Report an issue: GitHub.