remotion-dev/remotion · error · Error

Lambda function returned error: ${result.FunctionError} ${re

Error message

Lambda function returned error: ${result.FunctionError} ${result.LogResult}

What it means

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.

Source

Thrown at packages/lambda-client/src/call-lambda-async.ts:39

		throw new Error(
			`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}`,
		);
	}

	const result = await getLambdaClient(
		region as AwsRegion,
		timeoutInTest,
		null,
	).send(
		new InvokeCommand({
			FunctionName: functionName,
			Payload: stringifiedPayload,
			InvocationType: 'Event',
		}),
	);

	if (result.FunctionError) {
		throw new Error(
			`Lambda function returned error: ${result.FunctionError} ${result.LogResult}`,
		);
	}
};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Verify the function exists: npx remotion lambda functions ls (and check the region matches).
  2. Ensure the caller's IAM role has lambda:InvokeFunction on the function resource.
  3. Confirm functionName is the deployed function name (not the ARN unless required).
  4. Retry after a transient throttle; if persistent, raise the account's Lambda concurrency or stagger invocations.
  5. Decode result.LogResult (base64) to see the last 4 KB of the function's logs.

Example fix

// before
await renderMediaOnLambda({ functionName: 'remotion-render-prod', region: 'us-east-1' });
// function actually lives in eu-west-1

// after
await renderMediaOnLambda({ functionName: 'remotion-render-prod', region: 'eu-west-1' });
Defensive patterns

Strategy: try-catch

Validate before calling

const functions = await getFunctions({ region });
if (!functions.some((f) => f.functionName === targetName)) {
  throw new Error(`function ${targetName} not deployed in ${region}`);
}

Try / catch

try {
  await renderMediaOnLambda({ functionName, region });
} catch (e) {
  if (String((e as Error).message).startsWith('Lambda function returned error')) {
    // decode LogResult, check function existence/region/IAM, then surface or retry
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/bb7a20d9cf9126bd. Report an issue: GitHub.