Big news! We’re excited to announce that Background Functions are available in Beta for all teams with a Pro plan or higher.
In the time since we first released Netlify Functions, many customers have requested the ability to make their functions run longer than the default 10-second time limit. After all, if Netlify Functions use AWS Lambda under the hood, why can’t we have Lambda’s 15-minute time limit?
The trouble is, we pass Lambdas through an API gateway proxy layer. This makes it so you can call a function from a relative path on your site, like
/.netlify/functions/hello and receive a response back to the client. If you used AWS’s API Gateway, you’d have a seconds-long timeout, too. That’s because you can’t have a connection (or your app user on the other end) waiting for minutes to get a response.
So how do you run long-running serverless functions? You run them asynchronously, in the background. Send a call to a background function, and it will return a confirmation that the request was received, then continue doing its work. The client isn’t left waiting, and the function can take the time it needs to finish its task — up to the full 15 minutes.