Configure official public layers
Packaging all dependencies into every function's deployment package leads to large archives and duplicated effort across functions. Function Compute provides official public layers for common runtimes and dependency libraries. Add a public layer to share dependencies across functions without rebuilding them each time.
Public layers
The tables below list available public layers by category. For the full list, see Public layers. If you need a layer that isn't listed, contact us.
Custom runtimes
These layers provide runtime environments for custom runtimes such as Python 3.10 and Node.js 17. Some layers also bundle common dependency libraries. For example, Python310-Package-Collection includes frequently used Python packages.
The five PHP-related layers in the following table (PHP85-Debian12, PHP81-Debian10, PHP80-Debian10, PHP81, and PHP80) include fixes for CVE-2026-109618 and CVE-2026-109619 (Common Vulnerabilities and Exposures). Support for the PHP72 public layer ended in October 2026. Support for the PHP80 and PHP81 public layers and their corresponding Debian 10 public layers ends in November 2026. Migrate to PHP85-Debian12 after you verify compatibility. These end-of-support dates follow the Function Compute public layer maintenance schedule, which differs from the upstream PHP support lifecycle.
| Public layer | Compatible runtime | Description | References |
|---|---|---|---|
| PHP85-Debian12 | Custom.Debian12 | PHP 8.5 Debian 12 runtime layer | README.md |
| PHP81-Debian10 | Custom.Debian10 | PHP 8.1 Debian 10 runtime layer. Do not use v1. | README.md |
| PHP80-Debian10 | Custom.Debian10 | PHP 8.0 Debian 10 runtime layer. Do not use v2 or earlier. | README.md |
| Nginx | Custom.Debian10 | Nginx Debian 10 runtime layer | README.md |
| Python310 | Custom, Custom.Debian10 | Python 3.10.5 runtime layer | README.md |
| Python310-Package-Collection | Custom.Debian10 | A collection of common dependency libraries for the Python 3.10 runtime | README.md |
| Python39 | Custom, Custom.Debian10 | Python 3.9.13 runtime layer | README.md |
| Python39-Package-Collection | Custom, Custom.Debian10 | A collection of common dependency libraries for the Python 3.9 runtime | README.md |
| Python38 | Custom, Custom.Debian10 | Python 3.8.13 runtime layer | README.md |
| Python38-Package-Collection | Custom, Custom.Debian10 | A collection of common dependency libraries for the Python 3.8.13 runtime | README.md |
| Python36 | Custom | Python 3.6.15 runtime layer | README.md |
| Python36-Package-Collection | Custom | A collection of common dependency libraries for the Python 3.6.15 runtime | README.md |
| Dotnet6 | Custom, Custom.Debian10 | ASP.NET 6.0.5 runtime layer | README.md |
| PHP81 | Custom | PHP 8.1 runtime layer. Do not use v6 or earlier. | README.md |
| PHP80 | Custom | PHP 8.0 runtime layer. Do not use v7 or earlier. | README.md |
| PHP72 | Custom | PHP 7.2 runtime layer. Do not use any released version. Migrate after you verify compatibility. | README.md |
| Java8 | Custom.Debian10 | Java 8 runtime layer | README.md |
| Java11 | Custom, Custom.Debian10 | Java 11 runtime layer | README.md |
| Java17 | Custom, Custom.Debian10 | Java 17 runtime layer | README.md |
| Java21 | Custom.Debian10 | Java 21 runtime layer | README.md |
| Nodejs24 | Custom.Debian10, Custom.Debian11, Custom.Debian12 | Node.js 24 runtime layer, version 24.22.1 | README.md |
| Nodejs22 | Custom.Debian10, Custom.Debian11, Custom.Debian12 | Node.js 22 runtime layer, version 22.23.4 | README.md |
| Nodejs20 | Custom.Debian10 | Node.js 20 runtime layer | README.md |
| Nodejs18 | Custom.Debian10 | Node.js 18 runtime layer | README.md |
| Nodejs17 | Custom | Node.js 17 runtime layer | README.md |
| Nodejs16 | Custom, Custom.Debian10 | Node.js 16 runtime layer | README.md |
| Nodejs14 | Custom | Node.js 14 runtime layer | README.md |
| Nodejs12 | Custom | Node.js 12 runtime layer | README.md |
| Go1 | Custom.Debian10 | Go 1 runtime layer | README.md |
| Go118 | Custom | Go 1.x runtime layer | README.md |
-
The Alibaba Cloud Resource Name (ARN) of an official public layer uses the format
acs:fc:{region}:official:layers/{layerName}/versions/{version}. Use the layer names and version numbers in the preceding table, and replace{region}with the region of your function. Example:acs:fc:cn-hangzhou:official:layers/PHP85-Debian12/versions/1. -
When a new version of a public layer is released, existing functions are not upgraded automatically. Update the layer ARN that each function references. For compatibility and migration details, see PHP public layer security upgrade guide.
Common dependency libraries
| Public layer | Compatible runtime | Description | Core library version | References |
|---|---|---|---|---|
| Python310-OSS2 | Python 3.10, Custom.Debian10 | oss2: Object Storage Service (OSS) SDK for Python | - | README.md |
| Python39-OSS2 | Python 3.9, Custom.Debian10 | oss2: OSS SDK for Python | - | README.md |
| Python310-TensorFlow2x | Python 3.10, Custom.Debian10 | An open source machine learning framework (CPU edition) | tensorflow==2.15.0.post1 | README.md |
| Python3x-PyMongo4x | Python 3.10, Custom.Debian10 | An open source MongoDB driver for Python | PyMongo==4.6.1 | README.md |
| Python3x-Pandas2x | Python 3.9, Custom.Debian10 | An open source data analysis and processing tool based on NumPy | pandas==2.2.1 | README.md |
| Python310-PyTorch2x | Python 3.10, Custom.Debian10 | An open source machine learning framework (CPU edition) | torch==2.2.1+cpu | README.md |
| Python39-Pandas1x | Python 3.9, Custom, Custom.Debian10 | An open source data analysis and processing tool based on NumPy | pandas==1.4.3 | README.md |
| Python39-SciPy1x | Python 3.9, Custom, Custom.Debian10 | An open source scientific computing library | scipy==1.9.0, numpy==1.23.2 | README.md |
| Python36-SciPy1x | Python 3.6, Custom | An open source scientific computing library | scipy-1.5.4, numpy-1.19.5 | README.md |
| Python39-PyTorch1x | Python 3.9, Custom, Custom.Debian10 | An open source machine learning framework (CPU edition) | torch==1.12.1+cpu, torchaudio==0.12.1+cpu, torchvision==0.13.1+cpu | README.md |
| Python36-PyTorch1x | Python 3.6, Custom | An open source machine learning framework (CPU edition) | torch==1.10.2+cpu, torchaudio==0.10.2+cpu, torchvision==0.11.3+cpu | README.md |
| Python3-Flask3x | Python 3.10, Custom.Debian11, Custom.Debian10 | A Python-based lightweight web framework | flask-v3 | README.md |
| Python3-Flask2x | Python 3.9, Python 3.10, Custom, Custom.Debian10 | A Python-based lightweight web framework | flask-v2.2.2 | README.md |
| Nodejs-Puppeteer17x | Node.js 16, Node.js 14, Custom, Custom.Debian10 | A Headless Chrome tool | puppeteer-v17.1.0 | README.md |
| Nodejs-Puppeteer10x | Node.js 14, Node.js 12, Node.js 10, Custom | A Headless Chrome tool | puppeteer-v10.2.0 | README.md |
| Nodejs-Puppeteer19x | Custom.Debian10 | A Headless Chrome tool | puppeteer-v19.8.5 | README.md |
| Python310-Opencv4x | Python 3.10, Custom.Debian10 | A cross-platform library for computer vision | opencv_python-4.7.0.68 | README.md |
| Python38-Playwright | Custom.Debian10 | A tool for web page automation | playwright==1.31.1 | README.md |
| Poppler22x-Pdf2image | Python 3.10 | A library for rendering PDF documents | pdf2image-1.16.3, poppler-22.12.0 | README.md |
| SQLite3 | Python 3.9, Node.js 16, Node.js 14, Java 11, Java 8, Custom | A lightweight in-process relational database | 3.41.1 | README.md |
| FFmpeg6x | Python 3.10, Python 3.9, Node.js 16, Node.js 14, Java 11, Java 8, Custom, Custom.Debian10 | An open source toolkit for recording, converting, and streaming audio and video | 6.0 | README.md |
| ServerlessDevs | Python 3.10, Python 3.9, Python 3, Node.js 16, Node.js 14, Java 11, Java 8, Go 1, .NetCore 3.1, PHP 7.2, Custom, Custom.Debian10 | An open source serverless platform that provides a set of tools for developers | 2.1.14 | README.md |
Web frameworks
| Public layer | Compatible runtime | Core library version | References |
|---|---|---|---|
| Python3-Flask2x | Python 3.9, Python 3.10, Custom, Custom.Debian10 | flask-v2.2.2 | README.md |
Alibaba Cloud SDKs
| Public layer | Compatible runtime | Description | References |
|---|---|---|---|
| Python312-Aliyun-SDK | Python 3.12, Custom.Debian11 | Common Alibaba Cloud SDKs for Python 3.12 | README.md |
| Python310-Aliyun-SDK | Python 3.10, Custom.Debian10 | Common Alibaba Cloud SDKs for Python 3.10 | README.md |
| Python39-Aliyun-SDK | Python 3.9, Custom | Common Alibaba Cloud SDKs for Python 3.9 | README.md |
| Python36-Aliyun-SDK | Python 3.6, Custom | Common Alibaba Cloud SDKs for Python 3.6 | README.md |
| Nodejs-Aliyun-SDK | Node.js 20, Node.js 18, Node.js 16, Node.js 14, Custom, Custom.Debian10 | Common Alibaba Cloud SDKs (Node.js 20, Node.js 18, Node.js 16, and Node.js 14) | README.md |
| Aliyun-DataX | Python 3.6, Python 3.9, Custom, Custom.Debian10 | Open source edition of Alibaba Cloud DataWorks Data Integration | README.md |
How layers work
A function supports up to five layers in total, combining custom and public layers. When multiple layers are configured, Function Compute merges their contents into the /opt directory in reverse order. If two layers contain files with the same name, the file from the first configured layer takes precedence over files in later layers.
Add a public layer in the console
In the console, public layers are labeled Common Layer.
Prerequisites
Before you begin, ensure that you have:
-
A Function Compute function. To create one, see Create a function.
Add the layer
-
Log on to the Function Compute console. In the left-side navigation pane, click Functions.
-
In the top navigation bar, select a region. On the Functions page, click the name of the function you want to configure.
-
On the function details page, click the Configurations tab.
-
In the Advanced Configuration section, click Edit.
-
In the Advanced Configuration panel, click + Add Layer and select Add Official Common Layer. Choose a layer from the Official Common Layer drop-down list and a version from the Layer Version drop-down list, then click Deploy.
Add a public layer using Serverless Devs
Prerequisites
Before you begin, ensure that you have:
-
Serverless Devs installed and Docker configured. See Quick start.
-
Serverless Devs configured with your credentials. See Configure Serverless Devs.
Add the layer
-
List official public layers in a region:
s cli fc layer list --official --region cn-hangzhouThe output lists available layers with their ARNs. Copy the ARN of the layer you want to use.
- layerName: Python39-Aliyun-SDK arn: acs:fc:cn-hangzhou:official:layers/Python39-Aliyun-SDK/versions/3 version: 3 acl: 1 description: Python3.9 Aliyun SDK layer. compatibleRuntime: - custom - python3.9 - custom.debian10 - layerName: Python39-Package-Collection arn: acs:fc:cn-hangzhou:official:layers/Python39-Package-Collection/versions/3 version: 3 acl: 1 description: Python3.9 package collection layer. compatibleRuntime: - custom - custom.debian10Key fields in the output:
Field Description layerNameThe name of the layer versionThe layer version arnThe ARN of the layer version, used when attaching the layer to a function aclAccess control: 0= private,1= publicdescriptionA brief description of the layer compatibleRuntimeThe runtimes this layer supports -
In your project directory, create a
s.yamlfile and add the layer ARN to thelayersfield.edition: 3.0.0 name: hello-world-app access: "default" vars: # The global variables region: "cn-hangzhou" resources: hello_world: component: fc3 # The component name. # actions: # The custom execution logic. props: region: ${vars.region} functionName: "emoji" description: 'this is a layer demo' runtime: "python3.9" code: ./code handler: index.handler memorySize: 512 timeout: 60 internetAccess: true layers: # The ARNs of the layers attached to the function. - acs:fc:cn-hangzhou:official:layers/Python39-Aliyun-SDK/versions/3 -
Create a
codedirectory in your project directory and place your function code inside it. -
Deploy the function with the layer configured:
s deploy
What's next
-
Manage layers programmatically using the CreateFunction and UpdateFunction API operations.
-
If you see the error
xxx is not supported by layerwhen configuring a layer, see What do I do if "xxx is not supported by layer" is reported when I configure a layer for a function?