remotion-dev / remotion

🎥 Make videos programmatically with React

Home Page:https://remotion.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected end of JSON input

axelv71 opened this issue · comments

commented

Hello, I have a problem with the RenderMediaOnLambda, in fact, every time it returns the error : panic: unexpected end of JSON input. I use remotion version 4.0.130 on my lambda. This is my code

My function:

func Render(renderOptions RenderOptions) (*lambda_go_sdk.RemotionRenderResponse, error) {
	renderInputRequest := lambda_go_sdk.RemotionOptions{
		ServeUrl:              os.Getenv("REMOTION_APP_SERVE_URL"),
		Codec:                 "h264",
		Region:                renderOptions.Region,
		FunctionName:          os.Getenv("REMOTION_APP_FUNCTION_NAME"),
		Composition:           "TRIM-COMP",
		TimeoutInMilliseconds: 60000,
		FrameRange:            []int{renderOptions.Start, renderOptions.End},
		InputProps: map[string]interface{}{
			"videoUrl":  renderOptions.VideoUrl,
			"trimStart": renderOptions.Start,
			"trimEnd":   renderOptions.End,
			"duration":  renderOptions.Duration,
			"fps":       renderOptions.Fps,
		},
		DownloadBehavior: map[string]interface{}{
			"type":     "download",
			"fileName": "video.mp4",
		},
		Webhook: map[string]interface{}{
			"url": os.Getenv("CALLBACK_URL"),
			"customData": map[string]interface{}{
				"video_id":  renderOptions.VideoId,
				"video_url": renderOptions.VideoUrl,
				"user_id":   renderOptions.UserId,
				"short_id":  renderOptions.VideoReframeId,
			},
			"secret": nil,
		},
	}

	_, renderError := lambda_go_sdk.RenderMediaOnLambda(renderInputRequest)

	if renderError != nil {
		return nil, renderError
	}

	return nil, nil
}

When I call it:

region := remotion.GetRegion()
	renderOptions := remotion.RenderOptions{
		Region:         region,
		Start:          0,
		End:            120,
		VideoId:        0,
		VideoUrl:       signedUrl,
		VideoReframeId: 0,
		Duration:       600,
		Fps:            30,
		UserId:         0,
	}

	res, err := remotion.Render(renderOptions)
	if err != nil {
		panic(err)
	}

I don't understand, am I doing something wrong?

commented

I've just looked at the lambda logs and the rendering is correct.

Hi @axelv71!

You are right, we must have blindly upgraded the AWS SDK and it works differently now.
This will be fixed in the next Remotion version by #3778.

We've added more tests to ensure it doesn't break anymore.

commented

Thank you for your response, how will I be able to deploy the update?

@axelv71 v4.0.147 will most likely come out tomorrow.