{"record":{"id":"5edd23e44086a2e4","repo":"remotion-dev/remotion","slug":"customlayerarns-must-be-specified-when-deploying-t","errorCode":null,"errorMessage":"customLayerArns must be specified when deploying to AWS China regions because Remotion-hosted Layers are not available in the aws-cn partition.","messagePattern":"customLayerArns must be specified when deploying to AWS China regions because Remotion-hosted Layers are not available in the aws-cn partition\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/lambda/src/shared/validate-custom-layer-arns.ts","lineNumber":24,"sourceCode":"\nconst layerVersionArnRegex =\n\t/^arn:([a-z0-9][a-z0-9-]*):lambda:([a-z0-9-]+):(\\d{12}):layer:([A-Za-z0-9-_]+):(\\d+)$/;\n\nexport const validateCustomLayerArns = ({\n\tcustomLayerArns,\n\tenableLambdaInsights,\n\tregion,\n\truntimePreference,\n}: {\n\tcustomLayerArns: string[] | null;\n\tenableLambdaInsights: boolean;\n\tregion: AwsRegion;\n\truntimePreference: RuntimePreference;\n}) => {\n\tconst {partition} = LambdaClientInternals.getAwsRegionMetadata(region);\n\tif (customLayerArns === null) {\n\t\tif (partition === 'aws-cn') {\n\t\t\tthrow new Error(\n\t\t\t\t'customLayerArns must be specified when deploying to AWS China regions because Remotion-hosted Layers are not available in the aws-cn partition.',\n\t\t\t);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif (!Array.isArray(customLayerArns) || customLayerArns.length === 0) {\n\t\tthrow new TypeError('customLayerArns must contain at least one Layer ARN.');\n\t}\n\n\tif (runtimePreference !== 'default') {\n\t\tthrow new Error(\n\t\t\t'customLayerArns cannot be combined with a non-default runtimePreference.',\n\t\t);\n\t}\n\n\tif (customLayerArns.length + (enableLambdaInsights ? 1 : 0) > 5) {","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/remotion-dev/remotion/blob/10db9de07356446fb0edb3c3ae211369b693d18b/packages/lambda/src/shared/validate-custom-layer-arns.ts#L6-L42","documentation":"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.","triggerScenarios":"Calling deployFunction (or `npx remotion lambda function deploy`) with region cn-north-1 / cn-northwest-1 and `customLayerArns: null` (or omitted).","commonSituations":"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.","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."],"exampleFix":"// before\nawait deployFunction({region: 'cn-north-1', /* no customLayerArns */});\n\n// after\nawait deployFunction({\n  region: 'cn-north-1',\n  runtimePreference: 'default',\n  customLayerArns: [\n    'arn:aws-cn:lambda:cn-north-1:123456789012:layer:remotion-chromium:1',\n    'arn:aws-cn:lambda:cn-north-1:123456789012:layer:remotion-fonts:1',\n  ],\n});","handlingStrategy":"validation","validationCode":"const isChina = (region: string) => region.startsWith('cn-');\nif (isChina(region) && (!customLayerArns || customLayerArns.length === 0)) {\n  throw new Error('Build and pass customLayerArns for aws-cn before deploying');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["aws","aws-china","lambda-layers","deployfunction"],"backgroundTag":"aws-china-partition-unsupported","analyzedSha":"10db9de07356446fb0edb3c3ae211369b693d18b","analyzedAt":"2026-08-22T21:45:17.748Z","contentChangedAt":"2026-08-22T21:45:17.748Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}