{"record":{"id":"5c1246f6864743c8","repo":"remotion-dev/remotion","slug":"expected-current-user-id","errorCode":null,"errorMessage":"Expected current user ID","messagePattern":"Expected current user ID","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/lambda/src/functions/index.ts","lineNumber":47,"sourceCode":"\n\tconst buffered =\n\t\tparams.type === ServerlessRoutines.info ||\n\t\tparams.type === ServerlessRoutines.start ||\n\t\tparams.type === ServerlessRoutines.compositions;\n\n\ttry {\n\t\tprocess.env.__RESERVED_IS_INSIDE_REMOTION_LAMBDA = 'true';\n\t\tsetCurrentRequestId(context.awsRequestId);\n\t\tstopLeakDetection();\n\t\tif (!context?.invokedFunctionArn) {\n\t\t\tthrow new Error(\n\t\t\t\t'Lambda function unexpectedly does not have context.invokedFunctionArn',\n\t\t\t);\n\t\t}\n\n\t\tconst expectedBucketOwner = context.invokedFunctionArn.split(':')[4];\n\t\tif (!expectedBucketOwner) {\n\t\t\tthrow new Error('Expected current user ID');\n\t\t}\n\n\t\tawait innerHandler({\n\t\t\tparams,\n\t\t\tresponseWriter,\n\t\t\tcontext: {\n\t\t\t\trequestId: context.awsRequestId,\n\t\t\t\texpectedBucketOwner,\n\t\t\t\tgetRemainingTimeInMillis: () => context.getRemainingTimeInMillis(),\n\t\t\t},\n\t\t\tproviderSpecifics: LambdaClientInternals.awsImplementation,\n\t\t\tinsideFunctionSpecifics: serverAwsImplementation,\n\t\t});\n\t} catch (err) {\n\t\tif (!buffered) {\n\t\t\tthrow err;\n\t\t}\n","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/lambda/src/functions/index.ts#L29-L65","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\ninvokedFunctionArn: 'arn:aws:lambda'\n// after\ninvokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:remotion-render'","handlingStrategy":"validation","validationCode":"const parts = context.invokedFunctionArn.split(':');\nif (parts.length < 5 || !parts[4]) {\n  throw new Error('invokedFunctionArn must be a full ARN including account ID');\n}","typeGuard":"function hasAccountId(ctx: {invokedFunctionArn: string}): boolean {\n  return Boolean(ctx.invokedFunctionArn.split(':')[4]);\n}","tryCatchPattern":"try {\n  await routine(params, context, responseWriter);\n} catch (err) {\n  if ((err as Error).message === 'Expected current user ID') {\n    // malformed ARN; supply full arn:aws:lambda:region:account:function:name\n  } else throw err;\n}","preventionTips":["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"],"tags":["aws-lambda","arn","validation","s3"],"backgroundTag":"invalid-argument-format","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}