When extending your project with Serverless Functions, you might find yourself in a situation where adjusting the default behavior is necessary.
Today, we are adding a new functions configuration property to allow you to do just this.
Note: To take advantage of this feature, you need to use our Git Integration or Now CLI 16.5.0.

Custom Memory & Execution Duration

In most cases, zero configuration is required to create deployments with ZEIT Now. Every Serverless Function (in all projects created after November 8th) receives the following attributes by default:
  • Memory: 1024 MB (1 GB)
  • Maximum Execution Duration: 10s (Free), 60s (Pro), 600s (Business), or 900s (Enterprise)
Now, you can customize these values in your now.json file like so:
{
	"functions": {
		"api/test.js": {
			"memory": 3008,
			"maxDuration": 500
		}
	}
}

An example now.json file that shows how to customize the functions property.

Read more about the constraints for each property in our documentation.

Community Runtimes

When deploying Serverless Functions without configuration (using the /api directory), you can choose from a list of officially supported languages.
If the language you'd like to use is not part of this list, you can add functions to your now.json file to assign Community Runtimes to your Serverless Functions.
Community Runtimes are provided by a third-party, for example, now-php:
{
	"functions": {
		"api/test.php": {
			"runtime": "now-php@0.0.7"
		}
	}
}

An example now.json file that shows how to configure the now-php Community Runtime.

After configuring the functions property, your api/test.php Serverless Function will be executed using the now-php Community Runtime.
If you are interested in using a Community Runtime or creating one yourself, check out the following documentation pages:

API Changes

If you are developing applications on top of the ZEIT Now API, you will need to use v11 of the deployment creation endpoint to take advantage of the functions property.

Conclusion

With the new functions property, you can configure the memory and maximum execution duration of your Serverless Functions, or assign a custom runtime.
Note: The builds property will be deprecated in favor of functions.
This is just one of several features we are planning to launch in order to support advanced use cases of Serverless Functions on ZEIT Now.
Let us know what you think about this change!