---
title: "Long-Running Asynchronous Processes with Netlify Background Functions"
description: "Manage long-running tasks in JavaScript, TypeScript, or Go using asynchronously invoked Netlify Background Functions."
source: "https://www.netlify.com/blog/2021/12/28/long-running-asynchronous-processes-with-netlify-background-functions/"
last_updated: "2026-07-15T22:14:03.000Z"
---
> Throughout December we’ll be [highlighting a different Netlify feature each day](https://www.netlify.com/blog/2021/12/01/highlighting-a-different-netlify-feature-each-day-in-december/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=background-functions). It might just be the thing you need to unlock those creative juices, and [dust off that domain](https://www.netlify.com/blog/2021/12/01/dusty-domains-your-forgotten-domains-raise-money-for-charity/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=background-functions) you registered but never deployed! Keep an eye [on the blog](https://www.netlify.com/blog/2021/12/01/highlighting-a-different-netlify-feature-each-day-in-december/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=background-functions) and on [Twitter](https://twitter.com/netlify) for each feature!

Ain’t no serverless functions got time for that! If you noticed, that was a double negative because there is a serverless function that **DOES** have time for your long-running tasks: [Netlify Background Functions](https://docs.netlify.com/functions/background-functions/). You can write these serverless functions in JavaScript, Typescript, or Go and like regular [Netlify Functions](https://docs.netlify.com/functions/overview/), background functions are version-controlled, built, and deployed along with the rest of your Netlify site.

Here’s a little sample Background Function in Go that you can try to see a function running longer than 10 seconds:

```
package main
import (    "context"    "log"    "time"
    "github.com/aws/aws-lambda-go/events"    "github.com/aws/aws-lambda-go/lambda")
func handler(ctx context.Context, request events.APIGatewayProxyRequest) (*events.APIGatewayProxyResponse, error) {    for i := 0; i < 60; i++ {        log.Println(i)        time.Sleep(1 * time.Second)    }    return nil, nil}
func main() {    lambda.Start(handler)}
```

You can check out some more detailed examples:

-   [written in Go](https://github.com/futuregerald/next-function/blob/master/func_source/save.go)
-   [written in JavaScript](https://docs.netlify.com/functions/build-with-javascript/#background-function-format)
-   or [written in TypeScript](https://docs.netlify.com/functions/build-with-typescript/)

What exactly happens when you use a Background Function? Here are the details about the invocation and responses:

> When a function is invoked asynchronously, there is an initial `202` success response. If function execution returns an error, an execution retry happens after one minute. If it fails again, another retry happens two minutes later. When a background function is successfully executed, you generally pass the result to a destination other than the originating client.

Background Functions are currently in beta but try ‘em out, and take your time ;} Happy coding 👩🏻‍💻!

### Resources for the Road

-   [Background Function Documentation](https://docs.netlify.com/functions/background-functions/)
-   [Create a Background Function](https://docs.netlify.com/functions/build-with-javascript/)

### Share

-   [X (fka Twitter)](https://twitter.com/intent/tweet?text=Long-Running Asynchronous Processes with Netlify Background Functions&url=https://www.netlify.com/blog/2021/12/28/long-running-asynchronous-processes-with-netlify-background-functions//)
-   [LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.netlify.com%2Fblog%2F2021%2F12%2F28%2Flong-running-asynchronous-processes-with-netlify-background-functions%2F%2F)
-   [Facebook](https://www.facebook.com/sharer.php?u=https://www.netlify.com/blog/2021/12/28/long-running-asynchronous-processes-with-netlify-background-functions//)
-   [Bluesky](https://bsky.app/intent/compose?text=Long-Running Asynchronous Processes with Netlify Background Functions+https://www.netlify.com/blog/2021/12/28/long-running-asynchronous-processes-with-netlify-background-functions//)

## Keep reading

![](/_astro/bbe3cfe0b5d5228f5d0a66e26ce057de315c7712-1200x675_ZQfk21.webp)

Tools & Services December 3, 2025

[

### Vibe coding to production with Kiro powers

](/blog/vibe-coding-production-kiro-powers)

-   ![Profile picture of Gehrig Kunz](/_astro/b4e9f58d914d1334ea70d53ea55a1f26b26f1445-512x512_17SwOI.webp)
    
    Gehrig Kunz
    

![](/_astro/b596a7453ede5fe6739bd12506636fe522828198-2400x1351_1ANtEG.webp)

Tools & Services February 21, 2025

[

### Secure local development with Codezero for Netlify

](/blog/secure-local-development-codezero)

-   Kathleen Randall
    

## Recent posts

News & Announcements July 14, 2026

[

### More headroom, a lower per-credit rate, and a bill you can predict: introducing new Pro plan tiers

](/blog/new-pro-plan-tiers)

-   ![Profile picture of Gehrig Kunz](/_astro/b4e9f58d914d1334ea70d53ea55a1f26b26f1445-512x512_17SwOI.webp)
    
    Gehrig Kunz
    

News & Announcements July 13, 2026

[

### Netlify inside of Claude Design

](/blog/netlify-inside-of-claude-design)

-   ![Profile picture of Sean Roberts](/_astro/bbf2243f8171dbddd80ab2103622106cef84d125-512x512_Z1d2LKE.webp)
    
    Sean Roberts
    

News & Announcements June 25, 2026

[

### Netlify Functions, designed for Agent Experience

](/blog/netlify-functions-designed-for-agent-experience)

-   ![Profile picture of Eduardo Bouças](/_astro/52958f21e8450baf6d8e60302341a984e220c0cd-512x512_13VDlu.webp)
    
    Eduardo Bouças
    

![](/_astro/3f255b372fa958df35802666ee33b4609b2d71bd-1200x1586_1VtE2D.webp)

### How do the best dev and marketing teams work together?

[Access the report](https://www.netlify.com/reports/2024-leadership-trend-report/access/)