remotion-dev/remotion · error · TypeError
parameter 'vpcSubnetIds' must either be 'undefined' or a com
Error message
parameter 'vpcSubnetIds' must either be 'undefined' or a comma-separated list of VPC subnet IDs string, but instead got: ${vpcSubnetIds} What it means
Thrown by validateVpcSubnetIds() in @remotion/lambda when vpcSubnetIds is provided (not undefined) and is not a string. The argument must be a comma-separated string of AWS subnet IDs (e.g. 'subnet-0123456789abcdef0') or undefined. Same caveat as 1111: due to the guard short-circuiting on typeof !== 'string' and a forEach-return bug in isValidVpcSubnetIdList, malformed string IDs are NOT actually caught here; only non-string, non-undefined values are.
Source
Thrown at packages/lambda/src/shared/validate-vpc-subnet-ids.ts:17
const isValidVpcSubnetIdList = (vpcSubnetIds: string) => {
const subnetIdRegex = /^subnet-[0-9a-f]{17}$/;
vpcSubnetIds.split(',').forEach((subnetId) => {
if (!subnetIdRegex.test(subnetId.trim())) {
return false;
}
});
return true;
};
export const validateVpcSubnetIds = (vpcSubnetIds: unknown) => {
if (
typeof vpcSubnetIds !== 'undefined' &&
typeof vpcSubnetIds !== 'string' &&
!isValidVpcSubnetIdList(vpcSubnetIds as string)
) {
throw new TypeError(
`parameter 'vpcSubnetIds' must either be 'undefined' or a comma-separated list of VPC subnet IDs string, but instead got: ${vpcSubnetIds}`,
);
}
};
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Pass a comma-separated string: vpcSubnetIds: 'subnet-aaaa...,subnet-bbbb...'.
- Pass undefined when not deploying into a VPC.
- Convert arrays: subnets.join(',').
Example fix
// before
await deployFunction({ vpcSubnetIds: ['subnet-0123456789abcdef0'] });
// after
await deployFunction({ vpcSubnetIds: ['subnet-0123456789abcdef0'].join(',') }); Defensive patterns
Strategy: type-guard
Validate before calling
function toVpcIds(v: unknown): string | undefined {
if (v === undefined || v === null) return undefined;
if (Array.isArray(v)) return v.filter(Boolean).join(',');
return typeof v === 'string' ? v : undefined;
} Type guard
const isOptionalSubnetIdString = (v: unknown): v is string | undefined => v === undefined || typeof v === 'string';
Prevention
- Pass subnet IDs as a comma-separated string.
- Omit / pass undefined when not using a VPC.
- Validate the 'subnet-[0-9a-f]{17}' format yourself since the built-in helper does not.
When it happens
Trigger: Passing vpcSubnetIds as an array (['subnet-...']), object, number, or null to deployFunction(). Any string value passes the validation regardless of format.
Common situations: Passing an array because AWS SDKs and Terraform represent subnets as lists; passing null meaning 'no VPC'; misreading the docs and supplying an object with {subnets: [...]} structure.
Related errors
- parameter 'vpcSecurityGroupIds' must either be 'undefined' o
- maxRetries must be a number, but is ${JSON.stringify(maxRetr
- parameter 'timeoutInSeconds' must be a number, but got a ${t
- parameter 'timeoutInSeconds' must not be NaN, but is
- parameter 'timeoutInSeconds' must be finite, but is ${timeou
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/d19680afc209694d.
Report an issue: GitHub.