remotion-dev/remotion · error · Error
customLayerArns must be specified when deploying to AWS Chin
Error message
customLayerArns must be specified when deploying to AWS China regions because Remotion-hosted Layers are not available in the aws-cn partition.
What it means
validateCustomLayerArns throws this during deployFunction when no customLayerArns were provided but the target region resolves to the aws-cn partition. Remotion-hosted layers exist only in the commercial `aws` partition, so a deployment to AWS China has no default layers to attach and the function would be unusable without explicitly supplied layer ARNs.
Source
Thrown at packages/lambda/src/shared/validate-custom-layer-arns.ts:24
const layerVersionArnRegex =
/^arn:([a-z0-9][a-z0-9-]*):lambda:([a-z0-9-]+):(\d{12}):layer:([A-Za-z0-9-_]+):(\d+)$/;
export const validateCustomLayerArns = ({
customLayerArns,
enableLambdaInsights,
region,
runtimePreference,
}: {
customLayerArns: string[] | null;
enableLambdaInsights: boolean;
region: AwsRegion;
runtimePreference: RuntimePreference;
}) => {
const {partition} = LambdaClientInternals.getAwsRegionMetadata(region);
if (customLayerArns === null) {
if (partition === 'aws-cn') {
throw new Error(
'customLayerArns must be specified when deploying to AWS China regions because Remotion-hosted Layers are not available in the aws-cn partition.',
);
}
return;
}
if (!Array.isArray(customLayerArns) || customLayerArns.length === 0) {
throw new TypeError('customLayerArns must contain at least one Layer ARN.');
}
if (runtimePreference !== 'default') {
throw new Error(
'customLayerArns cannot be combined with a non-default runtimePreference.',
);
}
if (customLayerArns.length + (enableLambdaInsights ? 1 : 0) > 5) {View on GitHub (pinned to 10db9de073)
Solutions
- Copy the Remotion layer ZIPs (via `npx remotion lambda layers` in a supported region or the layer download URLs) into your China account, publish them as Lambda layers in cn-north-1/cn-northwest-1, and pass their version ARNs via `customLayerArns`.
- Verify every supplied ARN starts with `arn:aws-cn:lambda:cn-...` so partition/region checks pass.
- Keep runtimePreference at 'default' when supplying customLayerArns.
Example fix
// before
await deployFunction({region: 'cn-north-1', /* no customLayerArns */});
// after
await deployFunction({
region: 'cn-north-1',
runtimePreference: 'default',
customLayerArns: [
'arn:aws-cn:lambda:cn-north-1:123456789012:layer:remotion-chromium:1',
'arn:aws-cn:lambda:cn-north-1:123456789012:layer:remotion-fonts:1',
],
}); Defensive patterns
Strategy: validation
Validate before calling
const isChina = (region: string) => region.startsWith('cn-');
if (isChina(region) && (!customLayerArns || customLayerArns.length === 0)) {
throw new Error('Build and pass customLayerArns for aws-cn before deploying');
} Prevention
- Maintain a China-specific deploy config that always includes customLayerArns published in your cn account.
- Document the layer-publishing step (aws lambda publish-layer-version) as part of the China onboarding runbook.
- Add a CI check that fails China deploys without layer ARNs.
When it happens
Trigger: Calling deployFunction (or `npx remotion lambda function deploy`) with region cn-north-1 / cn-northwest-1 and `customLayerArns: null` (or omitted).
Common situations: Companies with an AWS China account deploying Remotion Lambda for the first time; copy-pasting a deploy script from a global-region setup into a China-region pipeline.
Related errors
- Remotion-hosted Layers are not available in ${region}.
- Lambda functions support at most 5 Layers, including the Lam
- The custom Layer ARN ${layerArn} uses partition ${match[1]},
- customLayerArns must contain at least one Layer ARN.
- customLayerArns cannot be combined with a non-default runtim
AI-assisted analysis of remotion-dev/remotion@10db9de073 (2026-08-22).
Data as JSON: /api/errors/5edd23e44086a2e4.
Report an issue: GitHub.