remotion-dev/remotion · error · error

could not invoke Lambda function %q: %w

Error message

could not invoke Lambda function %q: %w

What it means

Returned by invokeRenderLambda() / invokeRenderProgressLambda() in lambda-go when svc.Invoke() fails to call the Lambda function. The function name is interpolated with %q and the underlying AWS error is wrapped with %w. Causes include non-existent function, wrong region, permission denied, throttling, or network failure.

Source

Thrown at packages/lambda-go/invocations.go:43

	if validateError != nil {
		return nil, validateError
	}

	internalParamJsonObject, marshallingError := json.Marshal(internalParams)
	if marshallingError != nil {
		return nil, fmt.Errorf("could not serialize render parameters: %w", marshallingError)
	}

	invocationPayload := &lambda.InvokeInput{
		FunctionName: new(options.FunctionName),
		Payload:      internalParamJsonObject,
	}

	// Invoke Lambda function
	invocationResult, invocationError := svc.Invoke(context.Background(), invocationPayload)

	if invocationError != nil {
		return nil, fmt.Errorf("could not invoke Lambda function %q: %w", options.FunctionName, invocationError)
	}

	// Unmarshal response from Lambda function
	var renderResponseOutput RemotionRenderResponse

	responseMarshallingError := json.Unmarshal(invocationResult.Payload, &renderResponseOutput)

	if responseMarshallingError != nil {
		return nil, fmt.Errorf("could not parse Lambda response: %w", responseMarshallingError)
	}

	return &renderResponseOutput, nil
}

func invokeRenderProgressLambda(config RenderConfig) (*RenderProgress, error) {

	awsConfig, configError := awsconfig.LoadDefaultConfig(
		context.Background(),

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Verify the function name exists in the configured region: `aws lambda get-function --region <r> --function-name <n>`.
  2. Check the caller's IAM policy includes lambda:InvokeFunction on the function ARN.
  3. Inspect the wrapped error to distinguish NotFound vs. AccessDenied vs. TooManyRequestsException; retry only on throttle/transient errors.

Example fix

// before
resp, err := lambda_go_sdk.RenderMedia(lambda_go_sdk.RemotionOptions{Region: "us-east-1", FunctionName: "remotion-render"});

// after
// function actually deployed in us-west-2
resp, err := lambda_go_sdk.RenderMedia(lambda_go_sdk.RemotionOptions{Region: "us-west-2", FunctionName: "remotion-render-dev"});
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight: confirm the function is invocable.
if _, err := lambdaClient.GetFunction(ctx, &lambda.GetFunctionInput{FunctionName: &name}); err != nil { return err }

Try / catch

for i := 0; i < 3; i++ {
  resp, err := lambda_go_sdk.RenderMedia(opts)
  if err == nil { break }
  var apiErr smithy.APIError
  if errors.As(err, &apiErr) && (apiErr.ErrorCode() == "TooManyRequestsException" || apiErr.ErrorCode() == "ServiceUnavailable") {
    time.Sleep(backoff(i)); continue
  }
  return err // NotFound, AccessDenied — do not retry
}

Prevention

When it happens

Trigger: Passing options.FunctionName that does not exist in the configured region; an IAM principal without lambda:InvokeFunction; hitting the Lambda invocation throttle limit; transient network errors; the function being in UPDATE_IN_PROGRESS state.

Common situations: Typo in the function name; deploying the Lambda to a different region than the one set on RemotionOptions; the caller's IAM role lacks invoke permission; high concurrency pushing past account concurrency limits.

Related errors


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