Netlify function timeout: run an AI video job without waiting

Netlify functions stop at 60 seconds, scheduled ones at 30, background ones at 15 minutes. Submit the video job and take the result on a callback.

5 min readSume
All posts

A Netlify function has a 60-second synchronous execution limit by default, and Netlify's docs list it as not configurable. Scheduled functions get 30 seconds and background functions 15 minutes. An AI video job can outlast the first two, so don't wait for it inside the function: submit the job to Sume, return quickly, and take the finished video on a callback.

Netlify facts come from its functions configuration, background functions, scheduled functions and functions overview pages, read 2026-09-29. Sume facts come from Jobs and results and Videos. Sume has no Netlify integration: this is a plain HTTPS call from your function.

What is the Netlify function timeout?

It depends on the function type. Netlify's defaults table, dated by the page as last updated Sep 17, 2026, gives one limit per type, and marks each of them as not configurable.

From Netlify's functions configuration page, read 2026-09-29.
Function typeExecution limitConfigurable?
Synchronous60 secondsNo
Scheduled30 secondsNo
Background15 minutesNo
Background request/response payload256 KBNo

How do I start a Sume video job without hitting it?

Use a regular function that only submits. POST /v1/videos answers 202 with a job id, a polling_url and status: pending, so there's nothing to wait for. Give the request a callback_url (HTTPS) and an Idempotency-Key built from your own id, and keep the API key in a Netlify environment variable rather than in the browser.

import type { Config } from "@netlify/functions";

export default async (req: Request) => {
  const { orderId, prompt } = await req.json();
  const res = await fetch("https://api.sume.com/v1/videos", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.SUME_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": `order-${orderId}-video`,
    },
    body: JSON.stringify({
      model: "seedance-2",
      prompt,
      callback_url: "https://example.com/hooks/sume",
    }),
  });
  if (!res.ok) return new Response("submit failed", { status: 502 });
  const job = await res.json();
  return Response.json({ job_id: job.id }, { status: 202 });
};

export const config: Config = { method: "POST", path: "/submit" };

When does a Netlify background function help?

Set background: true in the function's config and Netlify gives the caller an empty 202 at once while the function runs for up to 15 minutes. Netlify says background functions don't return responses and that you generally pass the result to a destination other than the originating client. That suits work such as a submit followed by writing the job id into your database. It's not a reason to sit in a polling loop for a render: Sume's docs call submitting with async and polling the right answer for anything that can outlast 30 seconds, and a webhook callback removes the loop.

What happens if a background function errors?

Netlify retries it: if the invocation returns an error, a retry happens after one minute, and if it fails again, another retry happens two minutes later. A retry runs your submit code again, which is what the Idempotency-Key is for. Sume's docs say a same-key retry returns the original job instead of billing a second one, and to reuse a key only for the same operation and payload. A timeout on your side doesn't cancel the job either: it keeps running and still bills.

Can a scheduled function submit the job?

Yes, if it only submits. Netlify's scheduled functions page gives a 30-second execution limit and says they don't work with payloads or POST request data, so build the request from constants or your own data store. Receive the result in a separate regular function that verifies Sume's signature and returns 2xx quickly. Sume sends terminal events only, retries non-2xx responses up to 10 attempts, and allows 10 seconds per attempt.

Sources

Related posts

More in Integrations

All Integrations posts

Written by Sume