remotion-dev/remotion · error
Expected current user ID
Error message
Expected current user ID
What it means
After validating invokedFunctionArn, routine extracts the AWS account ID as the 5th colon-separated segment of the ARN (split(':')[4]) to use as the expected bucket owner. If the ARN is malformed or that segment is empty, this error is thrown. It protects against S3 bucket-owner misconfiguration.
Source
Thrown at packages/lambda/src/functions/index.ts:47
const buffered =
params.type === ServerlessRoutines.info ||
params.type === ServerlessRoutines.start ||
params.type === ServerlessRoutines.compositions;
try {
process.env.__RESERVED_IS_INSIDE_REMOTION_LAMBDA = 'true';
setCurrentRequestId(context.awsRequestId);
stopLeakDetection();
if (!context?.invokedFunctionArn) {
throw new Error(
'Lambda function unexpectedly does not have context.invokedFunctionArn',
);
}
const expectedBucketOwner = context.invokedFunctionArn.split(':')[4];
if (!expectedBucketOwner) {
throw new Error('Expected current user ID');
}
await innerHandler({
params,
responseWriter,
context: {
requestId: context.awsRequestId,
expectedBucketOwner,
getRemainingTimeInMillis: () => context.getRemainingTimeInMillis(),
},
providerSpecifics: LambdaClientInternals.awsImplementation,
insideFunctionSpecifics: serverAwsImplementation,
});
} catch (err) {
if (!buffered) {
throw err;
}
View on GitHub (pinned to b2f4e34732)
Solutions
- Ensure the stubbed/actual context.invokedFunctionArn is a full ARN of the form arn:aws:lambda:region:account-id:function:name.
- Fix test fixtures to use a realistic 5+-part ARN including the numeric account ID.
- If on a third-party Lambda-compatible platform, set the ARN correctly or run on real AWS Lambda where AWS guarantees the format.
Example fix
// before invokedFunctionArn: 'arn:aws:lambda' // after invokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:remotion-render'
Defensive patterns
Strategy: validation
Validate before calling
const parts = context.invokedFunctionArn.split(':');
if (parts.length < 5 || !parts[4]) {
throw new Error('invokedFunctionArn must be a full ARN including account ID');
} Type guard
function hasAccountId(ctx: {invokedFunctionArn: string}): boolean {
return Boolean(ctx.invokedFunctionArn.split(':')[4]);
} Try / catch
try {
await routine(params, context, responseWriter);
} catch (err) {
if ((err as Error).message === 'Expected current user ID') {
// malformed ARN; supply full arn:aws:lambda:region:account:function:name
} else throw err;
} Prevention
- Always stub invokedFunctionArn with a complete 5+-segment ARN in tests
- Validate ARN shape before invoking the handler
- Prefer running integration tests against real deployed Lambda functions
When it happens
Trigger: context.invokedFunctionArn exists but is not a valid Lambda ARN (fewer than 5 colon-separated parts, or an empty account segment) — e.g. a fake/stubbed context in tests or a non-standard runtime.
Common situations: Local handler tests with simplified ARN strings, proxying invocations through a wrapper that truncates the ARN, or invoking on a non-AWS Lambda-compatible runtime that supplies an incomplete ARN.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Pass --s3-output-provider-endpoint when using S3 output prov
- Pass --force-bucket-name when using S3 output provider flags
- Pass --out-name when using S3 output provider flags.
- The 'siteName' argument must be a string if provided, but is
- The `siteName` must not be `.` or `..`. You passed: ${siteNa
AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-09-09).
Data as JSON: /api/errors/5c1246f6864743c8.
Report an issue: GitHub.