remotion-dev/remotion · critical · error

could not load AWS config: %w

Error message

could not load AWS config: %w

What it means

Returned by the Go SDK (lambda-go) invokeRenderLambda() when awsconfig.LoadDefaultConfig() fails to build an AWS config for the given region. The Go error is wrapped with %w so the underlying AWS SDK error (missing credentials, invalid region, profile not found) is preserved for inspection via errors.Unwrap.

Source

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

package lambda_go_sdk

import (
	"context"
	"encoding/json"
	"fmt"

	awsconfig "github.com/aws/aws-sdk-go-v2/config"
	"github.com/aws/aws-sdk-go-v2/service/lambda"
)

func invokeRenderLambda(options RemotionOptions) (*RemotionRenderResponse, error) {

	awsConfig, configError := awsconfig.LoadDefaultConfig(
		context.Background(),
		awsconfig.WithRegion(options.Region),
	)
	if configError != nil {
		return nil, fmt.Errorf("could not load AWS config: %w", configError)
	}
	svc := lambda.NewFromConfig(awsConfig)

	internalParams, validateError := constructRenderInternals(&options)

	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,
	}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Run `aws configure` (or set AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_REGION) and retry.
  2. Verify options.Region is one of the valid AWS regions before calling RenderMedia().
  3. Inspect the wrapped error with errors.Unwrap or fmt.Printf("%+v", err) to see the exact credential/config failure.

Example fix

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

// after
os.Setenv("AWS_REGION", "us-east-1");
os.Setenv("AWS_ACCESS_KEY_ID", "AKIA...");
os.Setenv("AWS_SECRET_ACCESS_KEY", "...");
resp, err := lambda_go_sdk.RenderMedia(lambda_go_sdk.RemotionOptions{Region: "us-east-1", FunctionName: "remotion-render-dev"});
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify AWS config is loadable before calling RenderMedia.
cfg, err := awsconfig.LoadDefaultConfig(ctx, awsconfig.WithRegion("us-east-1"))
if err != nil { log.Fatalf("aws config: %v", err) }

Try / catch

resp, err := lambda_go_sdk.RenderMedia(opts)
if err != nil {
  if strings.Contains(err.Error(), "could not load AWS config") {
    // credential/config problem — surface to operator, do not retry.
  }
  var awsErr smithy.APIError; if errors.As(err, &awsErr) { /* classify */ }
}

Prevention

When it happens

Trigger: Calling RenderMedia() with options.Region unset or invalid, no AWS credentials in the environment (no env vars, no ~/.aws/credentials, no attached IAM role), or AWS_PROFILE pointing at a non-existent profile.

Common situations: Running the Go binary locally without `aws configure`; deploying to a host without an instance/role credential; a typo in AWS_REGION; an SDK v2 upgrade that changed credential-chain precedence.

Related errors


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