Back to Next Js

maxDuration

docs/01-app/03-api-reference/03-file-conventions/02-route-segment-config/maxDuration.mdx

16.2.5764 B
Original Source

The maxDuration option allows you to set the maximum execution time (in seconds) for server-side logic in a route segment. Deployment platforms can use maxDuration from the Next.js build output to add specific execution limits.

tsx
export const maxDuration = 5
js
export const maxDuration = 5

Server Actions

If using Server Actions, set the maxDuration at the page level to change the default timeout of all Server Actions used on the page.

Version History

VersionChanges
v13.4.10maxDuration introduced.