{"record":{"id":"ab0121b0ab71d1e6","repo":"remotion-dev/remotion","slug":"a-custom-role-arn-must-either-be-undefined-or-a","errorCode":null,"errorMessage":"A custom role ARN must either be \"undefined\" or a string, but instead got: ${JSON.stringify(customRoleArn)}","messagePattern":"A custom role ARN must either be \"undefined\" or a string, but instead got: (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda/src/shared/validate-custom-role-arn.ts","lineNumber":6,"sourceCode":"export const validateCustomRoleArn = (customRoleArn: unknown) => {\n\tif (\n\t\ttypeof customRoleArn !== 'undefined' &&\n\t\ttypeof customRoleArn !== 'string'\n\t) {\n\t\tthrow new TypeError(\n\t\t\t'A custom role ARN must either be \"undefined\" or a string, but instead got: ' +\n\t\t\t\tJSON.stringify(customRoleArn),\n\t\t);\n\t}\n};\n","sourceCodeStart":1,"sourceCodeEnd":12,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda/src/shared/validate-custom-role-arn.ts#L1-L12","documentation":"Thrown by validateCustomRoleArn() (a TypeError) when customRoleArn is neither undefined nor a string. Used by deployFunction() and the `functions deploy` CLI to gate the optional IAM execution-role override.","triggerScenarios":"Passing deployFunction({customRoleArn: ...}) with a number, boolean, object, or array instead of an ARN string or undefined.","commonSituations":"Reading customRoleArn from env/config without coercion; spreading a config object whose value is the wrong type; deserialised JSON where the field became a non-string.","solutions":["Pass either a role ARN string (arn:aws:iam::<account>:role/<name>) or omit it / set to undefined.","Coerce or validate the value to string|undefined before calling deployFunction.","Use the TypeScript type (customRoleArn?: string) so the compiler catches mismatches."],"exampleFix":"// before\ndeployFunction({region, customRoleArn: config.roleArn /* number? */})\n// after\nconst customRoleArn = typeof config.roleArn === 'string' ? config.roleArn : undefined\ndeployFunction({region, customRoleArn})","handlingStrategy":"type-guard","validationCode":"if (customRoleArn !== undefined && typeof customRoleArn !== 'string') {\n  throw new TypeError('customRoleArn must be undefined or a string')\n}","typeGuard":"const isValidCustomRoleArn = (v: unknown): v is string | undefined =>\n  v === undefined || typeof v === 'string'","tryCatchPattern":null,"preventionTips":["Type config fields explicitly as string | undefined.","When reading from env, coerce with a helper that returns string | undefined.","Validate role ARN shape (arn:aws:iam::...) in addition to type."],"tags":["aws","iam","validation","typescript","configuration"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}