Capítulo 477 de 988
<ExperimentalBadge> This feature is new. Please report any issues you encounter.
package main
import (
"fmt"
"log"
"os"
"github.com/go-playground/validator/v10"
"github.com/joho/godotenv"
"github.com/remotion-dev/lambda_go_sdk"
)
type ValidationError struct {
Field string
Message string
}
func msgForTag(fe validator.FieldError) string {
switch fe.Tag() {
case "required":
return "This field is required"
}
return fe.Error() // default error
}
func main() {
// Load the environment variables from the .env file
err := godotenv.Load()
if err != nil {
log.Fatal(err)
}
// Specify the URL to your Webpack bundle
serveUrl := os.Getenv("REMOTION_APP_SERVE_URL")
// Specify the function you would like to call
functionName := os.Getenv("REMOTION_APP_FUNCTION_NAME")
// Specify the region you deployed to, for example "us-east-1"
region := os.Getenv("REMOTION_APP_REGION")
// Set parameters for render
renderInputRequest := lambda_go_sdk.RemotionOptions{
ServeUrl: serveUrl,
FunctionName: functionName,
Region: region,
// The data that composition will use
InputProps: map[string]interface{}{
"data": "Let's play",
},
Composition: "main", // The composition to use
}
// Execute the render process
renderResponse, renderError := lambda_go_sdk.RenderMediaOnLambda(renderInputRequest)
// Check if there are validation errors
if renderError != nil {
validationOut := make([]ValidationError, len(renderError.(valida
// ...(truncated)