remotion-dev/remotion · error · Error

Failed to update Layers for function ${functionName}: ${conf

Error message

Failed to update Layers for function ${functionName}: ${configuration.StateReason ?? configuration.LastUpdateStatusReason ?? 'Unknown reason'}

What it means

When deploying with Remotion Lambda's createFunction() over an EXISTING function (alreadyCreated) with custom layer ARNs, the client updates the function's Layers via UpdateFunctionConfiguration and polls GetFunctionConfiguration until stable. If AWS reports State 'Failed' or LastUpdateStatus 'Failed', this error is thrown with the StateReason AWS provided - the layer update was rejected or broke the function.

Source

Thrown at packages/lambda/src/api/create-function.ts:185

			{indent: false, logLevel},
			`Updating Layers for function ${functionName}`,
		);
		await lambdaClient.send(
			new UpdateFunctionConfigurationCommand({
				FunctionName: functionName,
				Layers: layers,
			}),
		);

		while (true) {
			const configuration = await lambdaClient.send(
				new GetFunctionConfigurationCommand({FunctionName: functionName}),
			);
			if (
				configuration.State === 'Failed' ||
				configuration.LastUpdateStatus === 'Failed'
			) {
				throw new Error(
					`Failed to update Layers for function ${functionName}: ${configuration.StateReason ?? configuration.LastUpdateStatusReason ?? 'Unknown reason'}`,
				);
			}

			if (
				configuration.State === 'Active' &&
				configuration.LastUpdateStatus !== 'InProgress'
			) {
				break;
			}

			await new Promise<void>((resolve) => {
				setTimeout(resolve, 1000);
			});
		}

		return {FunctionName: functionName};
	}

View on GitHub (pinned to 10db9de073)

Solutions

  1. Read the StateReason in the message - it is AWS's own explanation (e.g. layer not found, incompatible architecture)
  2. Verify each layer ARN exists and matches the runtime: `aws lambda get-layer-version --layer-name NAME --version-number N --region REGION` (check CompatibleRuntimes includes nodejs24.x and CompatibleArchitectures includes arm64)
  3. Delete the function and redeploy fresh: `npx remotion lambda functions rm FUNCTION_NAME` then re-run `functions create` - a clean create skips the failing update path
  4. Ensure layer ARNs are in the same region and account as the function
  5. Check the deploy role has lambda:GetFunctionConfiguration, lambda:UpdateFunctionConfiguration and lambda:PutFunctionConfiguration* permissions

Example fix

# before - stale layer ARN on an existing function
npx remotion lambda functions create \
  --layer-arns arn:aws:lambda:eu-central-1:123456789:layer:my-layer:1

# after - verify the layer, then recreate the function
aws lambda get-layer-version-by-arn \
  --arn arn:aws:lambda:eu-central-1:123456789:layer:my-layer:3
npx remotion lambda functions rm remotion-render-3-3-0-
npx remotion lambda functions create \
  --layer-arns arn:aws:lambda:eu-central-1:123456789:layer:my-layer:3
Defensive patterns

Strategy: retry

Validate before calling

# Before deploying over an existing function, confirm every layer ARN resolves
# and matches runtime/architecture
for arn in $LAYER_ARNS; do
  aws lambda get-layer-version-by-arn --arn "$arn" --region "$REGION" \
    --query '{runtimes: CompatibleRuntimes, archs: CompatibleArchitectures}' --output text
  # expect: nodejs24.x (or similar)  arm64
done

Try / catch

// Wrap deployFunction and surface StateReason, then retry after correction
try {
  await deployFunction({/* ... */});
} catch (err) {
  if (
    err instanceof Error &&
    err.message.startsWith('Failed to update Layers for function')
  ) {
    console.error('Layer update rejected by AWS:', err.message);
    // fix layer ARNs (see StateReason), optionally delete + recreate the function, retry
    throw err;
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling `remotion lambda functions create` (or deployFunction) twice with --custom-role-arn/layer ARNs where the function already exists and the layer list changed, and AWS marks the layer update as Failed. Only happens in the alreadyCreated + customLayerArns path (packages/lambda/src/api/create-function.ts:170-188).

Common situations: Custom layer ARN deleted or version-number no longer exists; layer built for x86_64 while Remotion functions use arm64; layer incompatible with the nodejs24.x runtime; layer exceeds size limits; layer lives in a different region/account; IAM role lacking lambda:UpdateFunctionConfiguration leading AWS to report a failed state.

Related errors


AI-assisted analysis of remotion-dev/remotion@10db9de073 (2026-08-22). Data as JSON: /api/errors/a6bf2aabea7656e8. Report an issue: GitHub.