🎥 Make videos programmatically with React
Improve Lambda troubleshooting message
Jonny Burger59a920254477
diff --git a/packages/docs/docs/lambda/troubleshooting/debug.mdx b/packages/docs/docs/lambda/troubleshooting/debug.mdxindex 9de4cce844..6aa602b64a 100644--- a/packages/docs/docs/lambda/troubleshooting/debug.mdx+++ b/packages/docs/docs/lambda/troubleshooting/debug.mdx@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-troubleshooting-debug.pngid: debugsidebar_label: Debugging failurestitle: Debugging failed Lambda renders-crumb: "Lambda"+crumb: 'Lambda'---<YouTube@@ -13,33 +13,56 @@ crumb: "Lambda"title="How to troubleshoot and debug for Remotion Lambda"/>+## General debugging strategy++<Step>1</Step> Reproduce a render via the [`npx remotion lambda+render`](/docs/lambda/cli/render) command.+<br />+- Use `--props` to pass in a JSON file with the same input props as the render+you want to debug. - Use `--log=verbose` to get detailed debugging information.+<br />++<Step>2</Step> Wait for the render to fully time out or throw an error.+<br />+<Step>3</Step> Read the error message carefully and use the log links that were+printed.+<br />++## Reasons a render may fail+There are four reasons renders may fail:-<div><Step>1</Step> An error occurs in your React code. </div>-<div><Step>2</Step> A timeout occurs after calling <a href="/docs/delay-render"><code>delayRender()</code></a>.</div>-<div><Step>3</Step> The Lambda function rendering one of the chunks times out.</div>-<div><Step>4</Step> The main Lambda function times out. </div>+- <Step>1</Step> An error occurs in your React code.+- <Step>2</Step> A timeout occurs after calling+ [`delayRender()`](/docs/delay-render).+- <Step>3</Step> The Lambda function rendering one of the chunks times out.+- <Step>4</Step> The main Lambda function times out.{' '}## Error in React codeIf your code throws an error, you will see the error in the logs. If you are rendering via the CLI, the error will be symbolicated which can help you find the error in your code.Try to fix the error, redeploy the site and re-render.-## Understanding which timeout occurred+## Timeouts++### Understanding which timeout occurredIf your error message reads that a [`delayRender()`](/docs/delay-render) call timed out, a function has called [`delayRender()`](/docs/delay-render) but did not call [`continueRender()`](/docs/delay-render) within the timeout period. This is usually caused by a bug in your code. See [Debugging timeout](/docs/timeout) for more tips.:::noteYou can increase the timeout by passing `timeoutInMilliseconds` to [`renderMediaOnLamba()`](/docs/lambda/rendermediaonlambda) or passing `--timeout` to the CLI when rendering a video. Don't confuse it with the `--timeout` flag for the CLI when deploying a function (see below).:::+<br />-If your error message reads that the main Lambda function has timed out, it means that the render was still ongoing, but the maximum execution duration of the Lambda function has been hit. This is caused by either: <br/> <br/>+If your error message reads that the main Lambda function has timed out, it+means that the render was still ongoing, but the maximum execution duration of+the Lambda function has been hit. This is caused by either: <br /> <br />- A render that takes too long to complete within the specified duration. In that case, you should increase the function timeout by passing `--timeout` to the CLI [when deploying a function](/docs/lambda/cli/functions).- A render that has a bottleneck and completes slowly on Lambda. In that case, you should identify the bottleneck by measuring and optimizing the render. See [Optimizing for speed](/docs/lambda/optimizing-speed) for more tips.- A chunk is getting stuck, making it impossible for the main function to complete the task of concatenating the chunks. You should identify the chunk that is getting stuck by looking at the logs. See below for how to do this.-## Inspecting the logs+### Inspecting the logs<Step>1</Step> Get the Log URL:@@ -48,7 +71,8 @@ If your error message reads that the main Lambda function has timed out, it meanOpen this link and log into AWS if needed. A log stream will open.-<img src="/img/cloudwatch.png" /> <br/><br/>+<img src="/img/cloudwatch.png" /> <br />+<br />By default, the filter is set to:@@ -81,24 +105,31 @@ method=launch,renderId=[render-id]You should get one result.Click the blue link in the `Log stream name` column to open the log stream. If you don't see any blue links, click "Display", then select "View in columns with details".-## Finding the chunk that failed+### Finding the chunk that failedTo find which chunks failed to render, add `--log=verbose` to the Lambda render while rendering via the CLI. Look for a log statement `Render folder: ` to find the link to the render folder in S3.When using [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda), you will get a `folderInS3Console` field in the return value.After opening the link, open the `chunks` subfolder. Go through each existing chunk and find the ones that are missing. The missing chunks are the ones that failed to render.-<img src="/img/chunks.png" /> <br/><br/>+<img src="/img/chunks.png" /> <br />+<br />After you've identified which chunks are missing, [inspect the logs](#inspecting-the-logs) for that chunk to find the cause of the error.-## Increasing the timeout+### Increasing the timeoutNote that two types of timeouts come into play in Remotion:- The `delayRender()` timeout. This is the timeout that is defined using `--timeout` when calling [`npx remotion lambda render`](/docs/lambda/cli/render) or using `timeoutInMilliseconds` when calling [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda).- The Lambda function timeout. This is the timeout that is defined using `--timeout` when calling [`npx remotion lambda functions deploy`](/docs/lambda/cli/functions) or using `timeoutInSeconds` when calling [`deployFunction()`](/docs/lambda/deployfunction).+### Reporting an issue++You may report an issue on [GitHub](https://remotion.dev/help) and [Discord](https://remotion.dev/discord).+Include the `progress.json` that lies in the S3 folder of the render, because it includes all informations to reproduce a render.+If you include CloudWatch logs, post the full ones (click "Load more messages" until there are no more to load.)+## See also- [Debugging timeouts](/docs/timeout)