{"record":{"id":"02036012bb6fd526","repo":"remotion-dev/remotion","slug":"each-customlayerarns-entry-must-be-a-non-empty-str","errorCode":null,"errorMessage":"Each customLayerArns entry must be a non-empty string.","messagePattern":"Each customLayerArns entry must be a non-empty string\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda/src/shared/validate-custom-layer-arns.ts","lineNumber":51,"sourceCode":"\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) {\n\t\tthrow new Error(\n\t\t\t'Lambda functions support at most 5 Layers, including the Lambda Insights Layer.',\n\t\t);\n\t}\n\n\tconst seen = new Set<string>();\n\tfor (const layerArn of customLayerArns) {\n\t\tif (typeof layerArn !== 'string' || layerArn.length === 0) {\n\t\t\tthrow new TypeError(\n\t\t\t\t'Each customLayerArns entry must be a non-empty string.',\n\t\t\t);\n\t\t}\n\n\t\tconst match = layerArn.match(layerVersionArnRegex);\n\t\tif (!match) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`Invalid Lambda Layer version ARN: ${layerArn}. Expected arn:<partition>:lambda:<region>:<12-digit-account-id>:layer:<layer-name>:<numeric-version>.`,\n\t\t\t);\n\t\t}\n\n\t\tif (match[1] !== partition) {\n\t\t\tthrow new Error(\n\t\t\t\t`The custom Layer ARN ${layerArn} uses partition ${match[1]}, but region ${region} uses partition ${partition}.`,\n\t\t\t);\n\t\t}\n\n\t\tif (match[2] !== region) {","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/remotion-dev/remotion/blob/10db9de07356446fb0edb3c3ae211369b693d18b/packages/lambda/src/shared/validate-custom-layer-arns.ts#L33-L69","documentation":"validateCustomLayerArns iterates over every entry of customLayerArns and throws this TypeError when an entry is not a string or is an empty string. It is a shape check that runs before the ARN regex validation, so garbage entries (null, undefined, numbers, '') fail here rather than producing a confusing invalid-ARN message.","triggerScenarios":"Calling deployFunction with customLayerArns containing e.g. `undefined` (sparse config object values), `null`, a number, or `''`.","commonSituations":"Building the layer list from environment variables or config files where one entry is missing (`process.env.MY_LAYER_ARN` undefined); trailing empty string after a bad split/trim.","solutions":["Inspect each entry and remove/fix non-string or empty values.","Filter undefined values at the source, e.g. `.filter((arn): arn is string => typeof arn === 'string' && arn.length > 0)`.","Set the missing environment variable that was supposed to hold the ARN."],"exampleFix":"// before\nconst customLayerArns = [process.env.LAYER_ARN_1, process.env.LAYER_ARN_2]; // may contain undefined\nawait deployFunction({region: 'us-east-1', customLayerArns});\n\n// after\nconst customLayerArns = [process.env.LAYER_ARN_1, process.env.LAYER_ARN_2]\n  .filter((arn): arn is string => typeof arn === 'string' && arn.length > 0);\nawait deployFunction({region: 'us-east-1', customLayerArns: customLayerArns.length ? customLayerArns : null});","handlingStrategy":"validation","validationCode":"const sane = customLayerArns.every((a) => typeof a === 'string' && a.length > 0);\nif (!sane) throw new Error('customLayerArns contains empty/non-string entries');","typeGuard":"const isNonEmptyStringArray = (v: unknown): v is string[] =>\n  Array.isArray(v) && v.every((x) => typeof x === 'string' && x.length > 0);","tryCatchPattern":null,"preventionTips":["Filter env-derived arrays: `.filter((a): a is string => !!a)`.","Fail fast on missing env vars that feed layer lists instead of letting undefined through."],"tags":["validation","lambda-layers","typescript","environment-variables"],"backgroundTag":"invalid-argument-value","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"}