{"record":{"id":"b8ed6a135f4d7e53","repo":"remotion-dev/remotion","slug":"could-not-parse-lambda-response-w","errorCode":null,"errorMessage":"could not parse Lambda response: %w","messagePattern":"could not parse Lambda response: %w","errorType":"exception","errorClass":"error","httpStatus":null,"severity":"error","filePath":"packages/lambda-go/invocations.go","lineNumber":52,"sourceCode":"\tinvocationPayload := &lambda.InvokeInput{\n\t\tFunctionName: new(options.FunctionName),\n\t\tPayload:      internalParamJsonObject,\n\t}\n\n\t// Invoke Lambda function\n\tinvocationResult, invocationError := svc.Invoke(context.Background(), invocationPayload)\n\n\tif invocationError != nil {\n\t\treturn nil, fmt.Errorf(\"could not invoke Lambda function %q: %w\", options.FunctionName, invocationError)\n\t}\n\n\t// Unmarshal response from Lambda function\n\tvar renderResponseOutput RemotionRenderResponse\n\n\tresponseMarshallingError := json.Unmarshal(invocationResult.Payload, &renderResponseOutput)\n\n\tif responseMarshallingError != nil {\n\t\treturn nil, fmt.Errorf(\"could not parse Lambda response: %w\", responseMarshallingError)\n\t}\n\n\treturn &renderResponseOutput, nil\n}\n\nfunc invokeRenderProgressLambda(config RenderConfig) (*RenderProgress, error) {\n\n\tawsConfig, configError := awsconfig.LoadDefaultConfig(\n\t\tcontext.Background(),\n\t\tawsconfig.WithRegion(config.Region),\n\t)\n\tif configError != nil {\n\t\treturn nil, fmt.Errorf(\"could not load AWS config: %w\", configError)\n\t}\n\tsvc := lambda.NewFromConfig(awsConfig)\n\n\tinternalParams, validateError := constructGetProgressInternals(&config)\n","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-go/invocations.go#L34-L70","documentation":"Returned by invokeRenderLambda() in lambda-go when json.Unmarshal fails to parse the Lambda function's response payload into RemotionRenderResponse. This means the Lambda ran but returned a payload whose shape does not match the Go struct (missing required fields, type mismatches, or non-JSON output like an error stack trace).","triggerScenarios":"The Lambda function failed internally and returned an error object/string instead of a render response; a version mismatch between the Go SDK's RemotionRenderResponse struct and the deployed Lambda's output schema; the function returning HTML or a plain error string.","commonSituations":"The deployed Lambda is an older/newer version than the Go SDK expects (schema drift); the Lambda crashed and returned a runtime error payload; you pointed the Go SDK at a non-Remotion Lambda by mistake.","solutions":["Inspect invocationResult.Payload (capture it before unmarshalling) to see the actual bytes the Lambda returned.","Confirm the deployed Lambda version matches the Go SDK version you imported.","Check CloudWatch Logs for the function to see why it returned a non-standard payload."],"exampleFix":"// before\nresp, err := lambda_go_sdk.RenderMedia(opts)\nif err != nil { log.Fatal(err) } // opaque \"could not parse Lambda response\"\n\n// after (debug the raw payload)\nresult, invokeErr := svc.Invoke(ctx, payload)\nlog.Printf(\"raw payload: %s\", string(result.Payload)) // reveals HTML, error JSON, or version-mismatched schema\nvar resp RemotionRenderResponse\nif err := json.Unmarshal(result.Payload, &resp); err != nil { log.Fatal(err) }","handlingStrategy":"try-catch","validationCode":"// Version alignment check at build time: assert the Go SDK version matches the deployed Lambda version.\n// Deploy the Lambda via the same @remotion/lambda version the Go SDK was generated against.","typeGuard":null,"tryCatchPattern":"result, invokeErr := svc.Invoke(ctx, payload)\nif invokeErr != nil { return invokeErr }\nvar resp RemotionRenderResponse\nif err := json.Unmarshal(result.Payload, &resp); err != nil {\n  // surface the raw payload for diagnosis\n  return fmt.Errorf(\"unmarshal failed (%w); raw payload: %s\", err, string(result.Payload))\n}","preventionTips":["Keep the Go SDK version and the deployed Lambda version in lockstep.","Capture and log invocationResult.Payload on unmarshal failure to see what the Lambda actually returned.","Check CloudWatch Logs for the function when parsing fails — the Lambda may have errored."],"tags":["lambda-go","go","json","version-mismatch","aws"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}