{"record":{"id":"bb7a20d9cf9126bd","repo":"remotion-dev/remotion","slug":"lambda-function-returned-error-result-functione","errorCode":null,"errorMessage":"Lambda function returned error: ${result.FunctionError} ${result.LogResult}","messagePattern":"Lambda function returned error: (.+?) (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/lambda-client/src/call-lambda-async.ts","lineNumber":39,"sourceCode":"\t\tthrow new Error(\n\t\t\t`Payload is too big: ${stringifiedPayload.length} bytes. Maximum size is 256 KB. This should not happen, please report this to the Remotion team. Payload: ${stringifiedPayload}`,\n\t\t);\n\t}\n\n\tconst result = await getLambdaClient(\n\t\tregion as AwsRegion,\n\t\ttimeoutInTest,\n\t\tnull,\n\t).send(\n\t\tnew InvokeCommand({\n\t\t\tFunctionName: functionName,\n\t\t\tPayload: stringifiedPayload,\n\t\t\tInvocationType: 'Event',\n\t\t}),\n\t);\n\n\tif (result.FunctionError) {\n\t\tthrow new Error(\n\t\t\t`Lambda function returned error: ${result.FunctionError} ${result.LogResult}`,\n\t\t);\n\t}\n};\n","sourceCodeStart":21,"sourceCodeEnd":44,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-client/src/call-lambda-async.ts#L21-L44","documentation":"Thrown by callFunctionAsyncImplementation() in @remotion/lambda-client after an async (InvocationType 'Event') Lambda Invoke returns a FunctionError field. Even though Event invocations are fire-and-forget, AWS still reports synchronous invoke-time errors via FunctionError (e.g. the function does not exist, the role/permissions are wrong, or the account is throttled at invocation time). LogResult contains the base64-encoded last 4 KB of logs.","triggerScenarios":"Invoking a functionName that does not exist in the region; IAM permissions missing lambda:InvokeFunction; the function ARN/name is wrong; AWS throttling at submit time; the deployed function is in a failed state.","commonSituations":"Deploying to one region but invoking in another; deleting/redeploying the function between submit and invoke; a typo in functionName; CI using credentials that lack invoke rights; running right after a deploy that has not converged.","solutions":["Verify the function exists: npx remotion lambda functions ls (and check the region matches).","Ensure the caller's IAM role has lambda:InvokeFunction on the function resource.","Confirm functionName is the deployed function name (not the ARN unless required).","Retry after a transient throttle; if persistent, raise the account's Lambda concurrency or stagger invocations.","Decode result.LogResult (base64) to see the last 4 KB of the function's logs."],"exampleFix":"// before\nawait renderMediaOnLambda({ functionName: 'remotion-render-prod', region: 'us-east-1' });\n// function actually lives in eu-west-1\n\n// after\nawait renderMediaOnLambda({ functionName: 'remotion-render-prod', region: 'eu-west-1' });","handlingStrategy":"try-catch","validationCode":"const functions = await getFunctions({ region });\nif (!functions.some((f) => f.functionName === targetName)) {\n  throw new Error(`function ${targetName} not deployed in ${region}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await renderMediaOnLambda({ functionName, region });\n} catch (e) {\n  if (String((e as Error).message).startsWith('Lambda function returned error')) {\n    // decode LogResult, check function existence/region/IAM, then surface or retry\n  }\n  throw e;\n}","preventionTips":["Verify the function name and region match a deployed function before invoking.","Grant the caller lambda:InvokeFunction on the function ARN.","Redeploy if the function was deleted or replaced."],"tags":["lambda-client","aws-lambda","invocation","iam","runtime-error","region"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}