remotion-dev/remotion · critical · Error

Payload is too big: ${stringifiedPayload.length} bytes. Maxi

Error message

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}

What it means

Thrown by callFunctionAsyncImplementation() in @remotion/lambda-client when the JSON-serialized payload sent to a Lambda function (InvocationType 'Event' / async invocation) exceeds 256 KB. AWS Lambda caps the async invocation payload at 256 KB; beyond that the Invoke API rejects the call before execution. The message labels this as a defect ('This should not happen, please report this to the Remotion team') because Remotion is supposed to have already offloaded large inputs to S3 (serve URL / input props in S3) so the inline payload stays small.

Source

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

	CallFunctionOptions,
	CloudProvider,
	ServerlessRoutines,
} from '@remotion/serverless-client';
import {getLambdaClient} from './aws-clients';
import type {AwsRegion} from './regions';

export const callFunctionAsyncImplementation = async <
	T extends ServerlessRoutines,
	Provider extends CloudProvider,
>({
	functionName,
	payload,
	region,
	timeoutInTest,
}: CallFunctionOptions<T, Provider>): Promise<void> => {
	const stringifiedPayload = JSON.stringify(payload);
	if (stringifiedPayload.length > 256 * 1024) {
		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(

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Move large data into S3 and pass a serve URL / props URL instead of inline inputProps.
  2. Reduce the size of inputProps: strip unused fields, avoid base64 blobs, reference assets by URL.
  3. Use renderMediaOnLambda with a deployed serve source (serveUrl) and keep inputProps minimal.
  4. If you believe the payload should be small, file a Remotion issue with the payload size and structure.

Example fix

// before
await renderMediaOnLambda({
  serveUrl: 'bundle',
  inputProps: { hugeBase64Image: 'data:image/png;base64,iVBOR...' }, // >256KB
});

// after
// Upload the image to S3 and pass its URL
await renderMediaOnLambda({
  serveUrl: 'bundle',
  inputProps: { imageUrl: 'https://my-bucket.s3.amazonaws.com/image.png' },
});
Defensive patterns

Strategy: validation

Validate before calling

const serialized = JSON.stringify(inputProps);
if (serialized.length > 200_000) {
  throw new Error('inputProps too large; move data to S3 and pass a URL');
}

Try / catch

try {
  await renderMediaOnLambda({ ... });
} catch (e) {
  if (String((e as Error).message).includes('Payload is too big')) {
    // move large props to S3, then retry with a slim inputProps referencing the S3 URL
  } else throw e;
}

Prevention

When it happens

Trigger: Passing very large inputProps directly inline to renderMediaOnLambda()/renderStillOnLambda() instead of referencing a serve URL, embedding large base64-encoded assets in props, or shipping a huge serialized composition tree.

Common situations: Inlining a base64 image or long text corpus in inputProps; passing the whole composition JSON; rendering from a serve source that itself serializes a lot of data into the launch payload; upgrading to a version that changed payload chunking.

Related errors


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