withastro/astro · warning
maxDuration is set to ${maxDuration} seconds, which is longe
Error message
maxDuration is set to ${maxDuration} seconds, which is longer than the maximum allowed duration of 900 seconds. What it means
In its astro:config:done hook (server output only), the Vercel adapter validates the maxDuration option against Vercel's hard ceiling of 900 seconds for serverless functions. A larger value is accepted by the adapter but exceeds what most Vercel plans allow, so this warning (plus a follow-up about plans) is printed to flag that function execution may be cut off or the deployment may fail on Vercel's side.
Source
Thrown at packages/integrations/vercel/src/index.ts:347
},
...getAstroImageConfig(
imageService,
imagesConfig,
command,
devImageService,
config.image,
),
});
},
'astro:routes:resolved': (params) => {
routes = params.routes;
},
'astro:config:done': ({ setAdapter, config, logger, buildOutput }) => {
_buildOutput = buildOutput;
if (_buildOutput === 'server') {
if (maxDuration && maxDuration > 900) {
logger.warn(
`maxDuration is set to ${maxDuration} seconds, which is longer than the maximum allowed duration of 900 seconds.`,
);
logger.warn(
`Please make sure that your plan allows for this duration. See https://vercel.com/docs/functions/serverless-functions/runtimes#maxduration for more information.`,
);
}
const vercelConfigPath = new URL('vercel.json', config.root);
if (
config.trailingSlash &&
config.trailingSlash !== 'ignore' &&
existsSync(vercelConfigPath)
) {
try {
const vercelConfig = JSON.parse(readFileSync(vercelConfigPath, 'utf-8'));
if (
(vercelConfig.trailingSlash === true && config.trailingSlash === 'never') ||
(vercelConfig.trailingSlash === false && config.trailingSlash === 'always')
) {View on GitHub (pinned to 3578d45d34)
Solutions
- Lower maxDuration to 900 or less: vercel({ maxDuration: 900 }).
- If you genuinely need longer work, move it to a Vercel Cron Job, Fluid Compute, or a queued background function instead of one serverless invocation.
- Check your Vercel plan's actual per-function limit via the linked runtimes#maxduration doc and set maxDuration within it.
- Re-run astro build; the warning should no longer print.
Example fix
// before
export default defineConfig({
output: 'server',
adapter: vercel({ maxDuration: 1800 }),
});
// after
export default defineConfig({
output: 'server',
adapter: vercel({ maxDuration: 900 }),
}); Defensive patterns
Strategy: validation
Validate before calling
const MAX_ALLOWED = 900;
const safeDuration = (requested: number): number =>
Math.min(requested, MAX_ALLOWED);
const adapter = vercel({ maxDuration: safeDuration(1200) }); // -> 900 Prevention
- Cap maxDuration at 900 unless the Vercel plan document says otherwise.
- Move work longer than the limit to cron jobs or queued background functions.
- Check the adapter's SUPPORTED limits in its README after major upgrades.
When it happens
Trigger: vercel({ maxDuration: 1800 }) (any value > 900) with output: 'server' in astro.config; the condition maxDuration && maxDuration > 900 is true during astro:config:done.
Common situations: Long-running SSR work (large renders, external crawls, AI/LLM streaming) configured with generous timeouts; copying maxDuration from AWS Lambda configs where the limit is higher (up to 15 min); Pro/Enterprise users assuming 800s+ defaults without checking the plan.
Related errors
- Please make sure that your plan allows for this duration. Se
- maxDuration must be a positive number
- Your project is being built for Node.js ${major} as the runt
- Your project is being built for Node.js ${major} as the runt
- Your project is being built for Node.js ${major} as the ru
AI-assisted analysis of withastro/astro@3578d45d34 (2026-08-18).
Data as JSON: /api/errors/da16a3b65d4d5206.
Report an issue: GitHub.