🎥 Make videos programmatically with React
Lambda GO SDK: Fix error serialization
Jonny Burger173352e53977
diff --git a/packages/example/testlambdaintegrations.mjs b/packages/example/testlambdaintegrations.mjsindex 244c484675..b2a741ee95 100644--- a/packages/example/testlambdaintegrations.mjs+++ b/packages/example/testlambdaintegrations.mjs@@ -10,12 +10,8 @@ const functionName = execSync(.trim().split(' ')[0];-console.log('=== Ruby (Still) ===');-execSync(`bundle install --path=vendor/bundle`, {- cwd: '../lambda-ruby-example',- stdio: 'inherit',-});-execSync(`bundle exec ruby test_render_spec_still.rb`, {+console.log('=== Golang ===');+execSync(`go run main.go`, {env: {// eslint-disable-next-line no-undef...process.env,@@ -23,12 +19,15 @@ execSync(`bundle exec ruby test_render_spec_still.rb`, {REMOTION_APP_FUNCTION_NAME: functionName,REMOTION_APP_SERVE_URL: 'testbed-v6',},+ cwd: '../lambda-go-example',+ stdio: 'inherit',+});+console.log('=== Ruby (Still) ===');+execSync(`bundle install --path=vendor/bundle`, {cwd: '../lambda-ruby-example',stdio: 'inherit',});-console.log('=== Ruby (Video) ===');--execSync(`bundle exec ruby test_render_spec_media.rb`, {+execSync(`bundle exec ruby test_render_spec_still.rb`, {env: {// eslint-disable-next-line no-undef...process.env,@@ -39,9 +38,9 @@ execSync(`bundle exec ruby test_render_spec_media.rb`, {cwd: '../lambda-ruby-example',stdio: 'inherit',});+console.log('=== Ruby (Video) ===');-console.log('=== Golang ===');-execSync(`go run main.go`, {+execSync(`bundle exec ruby test_render_spec_media.rb`, {env: {// eslint-disable-next-line no-undef...process.env,@@ -49,9 +48,10 @@ execSync(`go run main.go`, {REMOTION_APP_FUNCTION_NAME: functionName,REMOTION_APP_SERVE_URL: 'testbed-v6',},- cwd: '../lambda-go-example',+ cwd: '../lambda-ruby-example',stdio: 'inherit',});+console.log('=== PHP ===');execSync(`php src/render.php`, {env: {diff --git a/packages/lambda-go-example/main.go b/packages/lambda-go-example/main.goindex 58827ba61d..6311f8fe9f 100755--- a/packages/lambda-go-example/main.go+++ b/packages/lambda-go-example/main.go@@ -4,6 +4,7 @@ import ("fmt""log""os"+ "time""github.com/go-playground/validator/v10""github.com/joho/godotenv"@@ -48,7 +49,7 @@ func main() {InputProps: map[string]interface{}{"data": "Let's play",},- Composition: "main", // The composition to use+ Composition: "react-svg", // The composition to use}@@ -82,7 +83,6 @@ func main() {fmt.Print(renderResponse.RenderId)/// Get bucket informationfmt.Printf("bucketName: %s\nRenderId: %s\n", renderResponse.RenderId, renderResponse.RenderId)-// Render Progress requestrenderProgressInputRequest := lambda_go_sdk.RenderConfig{FunctionName: functionName,@@ -91,14 +91,33 @@ func main() {BucketName: renderResponse.BucketName,LogLevel: "info",}- // Execute getting the render progress- renderProgressResponse, renderProgressError := lambda_go_sdk.GetRenderProgress(renderProgressInputRequest)- // Check if we have error- if renderProgressError != nil {- log.Fatalf("%s %s", "Invalid render progress response", renderProgressError)- }+ // Keep checking progress until render is complete+ for {+ // Execute getting the render progress+ renderProgressResponse, renderProgressError := lambda_go_sdk.GetRenderProgress(renderProgressInputRequest)++ // Check if we have error+ if renderProgressError != nil {+ log.Fatalf("%s %s", "Invalid render progress response", renderProgressError)+ }- // Get the overall render progress- fmt.Printf("overallprogress: %f ", renderProgressResponse.OverallProgress)+ if len(renderProgressResponse.Errors) > 0 {+ fmt.Printf("errors: %v\n", renderProgressResponse.Errors)+ }+ if renderProgressResponse.FatalErrorEncountered {+ log.Fatalf("%s %v", "Fatal error encountered", renderProgressResponse.Errors)+ }++ // Get the overall render progress+ fmt.Printf("overallprogress: %f\n", renderProgressResponse.OverallProgress)++ if renderProgressResponse.OverallProgress >= 1.0 {+ fmt.Printf("Render completed %s\n", *renderProgressResponse.OutputFile)+ break+ }++ // Wait a bit before checking again+ time.Sleep(1 * time.Second)+ }}diff --git a/packages/lambda-go/models.go b/packages/lambda-go/models.goindex a7289cde1b..f155d17d1b 100644--- a/packages/lambda-go/models.go+++ b/packages/lambda-go/models.go@@ -129,25 +129,49 @@ type renderProgressInternalConfig struct {LogLevel string `json:"logLevel" validate:"required"`}+type FileNameAndSize struct {+ Name string `json:"name"`+ Size int `json:"size"`+}++type TmpDir struct {+ Files []FileNameAndSize `json:"files"`+ Total int `json:"total"`+}++type FunctionErrorInfo struct {+ Type string `json:"type"`+ Message string `json:"message"`+ Name string `json:"name"`+ Stack string `json:"stack"`+ Frame *int `json:"frame,omitempty"`+ Chunk *int `json:"chunk,omitempty"`+ IsFatal bool `json:"isFatal"`+ Attempt int `json:"attempt"`+ WillRetry bool `json:"willRetry"`+ TotalAttempts int `json:"totalAttempts"`+ TmpDir *TmpDir `json:"tmpDir,omitempty"`+}+type RenderProgress struct {- OverallProgress float64 `json:"overallProgress"`- Chunks int `json:"chunks"`- Done bool `json:"done"`- EncodingStatus *EncodingStatus `json:"encodingStatus,omitempty"`- Costs *Costs `json:"costs,omitempty"`- RenderId string `json:"renderId"`- RenderMetadata *RenderMetadata `json:"renderMetadata,omitempty"`- OutputFile *string `json:"outputFile,omitempty"`- OutKey *string `json:"outKey,omitempty"`- TimeToFinish *int `json:"timeToFinish,omitempty"`- Errors []string `json:"errors,omitempty"`- FatalErrorEncountered bool `json:"fatalErrorEncountered"`- CurrentTime int64 `json:"currentTime"`- RenderSize int64 `json:"renderSize"`- OutputSizeInBytes *int64 `json:"outputSizeInBytes,omitempty"`- LambdasInvoked int `json:"lambdasInvoked"`- FramesRendered *int `json:"framesRendered,omitempty"`- MostExpensiveFrameRanges []FrameRange `json:"mostExpensiveFrameRanges,omitempty"`+ OverallProgress float64 `json:"overallProgress"`+ Chunks int `json:"chunks"`+ Done bool `json:"done"`+ EncodingStatus *EncodingStatus `json:"encodingStatus,omitempty"`+ Costs *Costs `json:"costs,omitempty"`+ RenderId string `json:"renderId"`+ RenderMetadata *RenderMetadata `json:"renderMetadata,omitempty"`+ OutputFile *string `json:"outputFile,omitempty"`+ OutKey *string `json:"outKey,omitempty"`+ TimeToFinish *int `json:"timeToFinish,omitempty"`+ Errors []FunctionErrorInfo `json:"errors,omitempty"`+ FatalErrorEncountered bool `json:"fatalErrorEncountered"`+ CurrentTime int64 `json:"currentTime"`+ RenderSize int64 `json:"renderSize"`+ OutputSizeInBytes *int64 `json:"outputSizeInBytes,omitempty"`+ LambdasInvoked int `json:"lambdasInvoked"`+ FramesRendered *int `json:"framesRendered,omitempty"`+ MostExpensiveFrameRanges []FrameRange `json:"mostExpensiveFrameRanges,omitempty"`}type EncodingStatus struct {diff --git a/packages/lambda-ruby-example/Gemfile.lock b/packages/lambda-ruby-example/Gemfile.lockindex fd77222a31..a3978d8547 100644--- a/packages/lambda-ruby-example/Gemfile.lock+++ b/packages/lambda-ruby-example/Gemfile.lock@@ -1,7 +1,7 @@PATHremote: ../lambda-rubyspecs:- remotion_lambda (4.0.237)+ remotion_lambda (4.0.288)aws-sdk-lambda (> 1.0.0)json (> 2.0.0)logger (> 1.0.0)@@ -9,21 +9,24 @@ PATHGEMremote: https://rubygems.org/specs:- aws-eventstream (1.3.0)- aws-partitions (1.1020.0)- aws-sdk-core (3.214.0)+ aws-eventstream (1.3.2)+ aws-partitions (1.1089.0)+ aws-sdk-core (3.222.2)aws-eventstream (~> 1, >= 1.3.0)aws-partitions (~> 1, >= 1.992.0)aws-sigv4 (~> 1.9)+ base64jmespath (~> 1, >= 1.6.1)- aws-sdk-lambda (1.144.0)- aws-sdk-core (~> 3, >= 3.210.0)+ logger+ aws-sdk-lambda (1.148.0)+ aws-sdk-core (~> 3, >= 3.216.0)aws-sigv4 (~> 1.5)- aws-sigv4 (1.10.1)+ aws-sigv4 (1.11.0)aws-eventstream (~> 1, >= 1.0.2)+ base64 (0.2.0)jmespath (1.6.2)- json (2.9.0)- logger (1.6.2)+ json (2.10.2)+ logger (1.7.0)PLATFORMSruby