The error "xxx is not supported by layer" indicates that the layer is incompatible with the runtime of your function. This error may occur when you use a custom layer, an official Function Compute public layer, or an unofficial public layer.
Problem description
The error "xxx is not supported by layer" is reported when you configure a layer for a function.
InvalidArgument: code: 400, runtime: custom is not supported by layer:acs:fc:cn-hangzhou:official:layers/Java21/versions/1
Possible causes
The runtime of the function is not compatible with the layer. Specifically, the runtime of the function is not included in the compatible runtimes of the layer.
Solutions
Custom layer
If you use a custom layer, you can replace the layer with another layer that is compatible with the runtime of your function. You can also create a new version for the custom layer you use and add the runtime of your function to the compatible runtimes of the layer of the new version. For more information, see Create a custom layer.
Official public layer
If you use an official Function Compute layer, you can query the compatible runtimes and usage methods of the layer in Public layers supported by Function Compute. If the runtime of your function is not supported by the layer, you can replace the runtime of your function or use another official public layer based on your business requirements. If no official public layers can meet your business requirements, contact us.
Function Compute documentation lists only some commonly used official public layers. For more information about official public layers, see Public layers.
Unofficial public layer
Function Compute does not provide technical support and maintenance for unofficial public layers. Contact the entity that provided the public layer for you to check the compatible runtimes and usage methods of the layer.