Skip to content

netlify/next-scheduled-bg-function-migration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Migrating Next.js Advanced API Routes to Netlify Functions

Why do I need to do this?

Starting with version 5 of Netlify's Next.js Runtime (applicable for Next.js 13.5+), support for background and scheduled functions implemented as Next.js API Routes (a.k.a. Advanced API routes) is deprecated.

Instead, use regular background or scheduled Netlify Functions for the same purposes.

The main reason for dropping support is to improve robustness of the runtime: with v5, our goal is to simplify the runtime codebase as possible, and avoid adding or overriding functionality to built-in constructs of Next.js. This also allows us to focus on improving the core framework-agnostic features, which are applicable for all frameworks.

Here are annotated examples of advanced API routes and their framework-agnostic counterparts:

Scheduled Functions

Background Functions

NOTE: Netlify background functions file or directory needs to end in -background suffix.

Using Next.js APIs

If your scheduled or background functions require access to Next.js APIs (e.g. on-demand revalidation via revalidatePath or revalidateTag), you will need to create a Next.js API route / Route Handler that is called from your Netlify function and has access to these APIs.

The above examples both showcase this.

About

No description, website, or topics provided.

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published