惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
H
Help Net Security
Jina AI
Jina AI
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
博客园 - 叶小钗
Y
Y Combinator Blog
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
WordPress大学
WordPress大学
C
Check Point Blog
Recent Announcements
Recent Announcements
IT之家
IT之家
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
美团技术团队
云风的 BLOG
云风的 BLOG
雷峰网
雷峰网
H
Hackread – Cybersecurity News, Data Breaches, AI and More
S
SegmentFault 最新的问题
MyScale Blog
MyScale Blog
Apple Machine Learning Research
Apple Machine Learning Research
Microsoft Azure Blog
Microsoft Azure Blog
V
Visual Studio Blog
B
Blog

Netlify Changelog

Gemini 3.5 Flash now available in Agent Runners 4 Nuxt CVEs: what Netlify users need to know Gemini 3.5 Flash now available in AI Gateway Agent Runners workflow improvements Next.js & React security release (May 2026): what to know Block project transfers out of your team Gemini 3.1 Flash-Lite now available in AI Gateway OpenAI GPT-5.5 Instant now available in AI Gateway New `netlify logs` CLI command Deploy to Netlify with Stripe Projects Netlify Database is now generally available OpenAI GPT-5.5 and GPT-5.5 Pro in AI Gateway & Agent Runners Rename an agent run GPT Image 2 now available in AI Gateway New frontend-design skill for Agent Runners Claude Opus 4.7 now available in AI Gateway and Agent Runners Pricing updates for Credit-based plans New sorting and filter controls on the Members page Netlify Database GA coming soon, no new databases for now Deploy logs streaming is now faster Netlify CLI adds prompt-based creation and anonymous deploys Deploy from Codex with the Netlify Plugin Hydrogen with React Router 7 now supported on Netlify Monitor credit usage by day Invoices for Enterprise Available on the Billing Page AI app development on production infrastructure with Netlify Introducing Prompt Templates OpenAI GPT-5.4 Nano and GPT-5.4 Mini in AI Gateway Change your pricing plan Internal Builder Role & Project Access Controls
Netlify’s New Background and Scheduled API Routes for Nex...
Nahrin Jalal · 2022-10-20 · via Netlify Changelog

Web apps are now heavily API-driven, bringing instant data access and interactivity into the user experience. However, for some API requests like batch processing, which must verify and publish large volumes of data resulting in longer request times, additional development work is needed to write and maintain the appropriate serverless logic. This remains true even for popular frameworks like Next.js, and a simpler solution to run API routes asynchronously in the background or on a predefined schedule like a cron job is more ideal.

Today, we’re excited to announce Background and Scheduled API Routes for the Next.js framework. This means developers can build, deploy, preview, and instantly rollback API routes as background and scheduled functions right alongside other serverless functions—all maintained in the same Git repo as frontend code.

Because this capability is implemented through Netlify’s unique Next.js Runtime, developers can use scheduled and background API routes without having to rely on third-party services or write scaffolding code. And most importantly, this new functionality requires minimal configurations. Read more about the new feature in Netlify’s Next.js documentation!

Use Cases for Background and Scheduled API Routes for Next.js

Next.js API Routes can be deployed with a single folder in a Next.js project. This is a great starting point for a lot of scenarios like handling form input or masking the URL of external services, but longer-running or scheduled tasks with API routes still require overhead work. To overcome these shortcomings, developers typically rely on external services such as GitHub Actions, Upstash’s QStash, or Pipedream, or implement other workarounds that increase both complexity and cost.

Background API Routes allow developers to leverage a native functionality within Next.js to deliver a smooth end-user experience that eliminates the need to wait for longer-running tasks to complete. For instance, the following tasks can be pushed to the background:

  • Batch processing
  • Web scraping
  • Media processing/optimization
  • Intensive computation

Similarly, Scheduled API Routes enable Next.js developers to more easily execute tasks such as:

  • Data backups to Git repos
  • Invoice processing
  • Data fetching for self-updating dashboards
  • Abandoned cart recovery

All of the above are natively enabled with zero configuration through Next.js Runtime on Netlify.

Getting Started

You don’t need to install anything to use the new API route types on Netlify. Start by setting the “type” value in the configuration file, as shown in the examples below.

Background API Routes

Implemented using Netlify Background Functions, these are triggered the same way as regular API routes. However, instead of needing to return within 10 seconds, they immediately return a “202 Accepted” response and can then run in the background for up to 15 minutes. To enable them, export the following config object:

export default async (req, res) => {

// Do something slow

}

export const config = {

type: 'experimental-background',

}

Note that Netlify Background Functions require Netlify’s Pro plan or above.

Scheduled API Routes

Also known as cron functions, these are functions which are triggered on a schedule rather than via a web request. They will return a 404 if you try to request them normally. To enable them, export the following config:

export default (req, res) => {

// Do something scheduled

res.send()

}

export const config = {

type: 'experimental-scheduled',

schedule: '@hourly',

}

The schedule field uses cron expression format. Scheduled functions only run once deployed to production. To test them locally, request them like a normal API route. Scheduled functions are available on every Netlify plan.

Achieve more with Next.js and Netlify today

Next.js is one of the most popular frameworks for developers, and we remain committed to providing the most rewarding and seamless developer experience when pushing Next.js apps to production. To learn more about deploying Next.js projects on Netlify and the added value delivered to developers, visit Next.js on Netlify docs.