🎥 Make videos programmatically with React
handle rate limit
Jonny Burger91ac7fdf86ab
diff --git a/packages/docs/docs/lambda/troubleshooting/rate-limit.md b/packages/docs/docs/lambda/troubleshooting/rate-limit.mdnew file mode 100644index 0000000000..9eaaa70c4b--- /dev/null+++ b/packages/docs/docs/lambda/troubleshooting/rate-limit.md@@ -0,0 +1,48 @@+---+id: rate-limit+sidebar_label: Rate Limit+title: AWS Rate Limit Troubleshooting+---++If you get an error message:++```+TooManyRequestsException: Rate Exceeded.+```++while calling a Lambda function, it means your concurrency limit or burst limit has been reached.++- **Concurrency limit**: The maximum amount of Lambda functions that can run concurrently per region per account.+- **Burst limit**: The maximum amount of Lambda functions which can spawn in a short amount of time.++## Default concurrency limits++By default, the concurrency limit is 1000 functions per region, however in some regions the burst limit is only 500, somewhat limiting the scale you can use.++## Exception: New accounts using AWS Lambda++According to AWS, "some accounts" which are new to AWS Lambda might get a very low concurrency limit such as 10 when they first start with AWS Lambda. In that case, increase the limit via the AWS console or the Remotion CLI (see below)++## See your limits++To see your limits, run++```+npx remotion lambda quotas+```++:::note+If you get a permission error, repeat the user policy step in the [Setup Guide](/docs/lambda/setup) and update your user policy file in the AWS console.+:::++## Request an increase++You can request a quota increase under [`https://console.aws.amazon.com/servicequotas/home`](https://console.aws.amazon.com/servicequotas/home) or using the [Remotion CLI](/docs/lambda/cli/quotas):++```+npx remotion lambda quotas increase+```++## Unhelpful?++Contact the Remotion team, preferrably via [Discord](https://discord.gg/6VzzNDwUwV) and we will be happy to help you with your rate limit problem.diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex 09859ba060..b2b87f4c86 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -100,7 +100,10 @@ module.exports = {collapsed: false,type: "category",label: "Troubleshooting",- items: ["lambda/troubleshooting/permissions"],+ items: [+ "lambda/troubleshooting/permissions",+ "lambda/troubleshooting/rate-limit",+ ],},"lambda/changelog","lambda/upgrading",diff --git a/packages/lambda/src/cli/index.ts b/packages/lambda/src/cli/index.tsindex 0852debdc0..24209c0043 100644--- a/packages/lambda/src/cli/index.ts+++ b/packages/lambda/src/cli/index.ts@@ -137,6 +137,14 @@ AWS returned an "AccessDenied" error message meaning a permission is missing. Re);}+ if (error.stack?.includes('TooManyRequestsException')) {+ Log.error(+ `+AWS returned an "TooManyRequestsException" error message which could mean you reached the concurrency limit of AWS Lambda. You can increase the limit - read this troubleshooting page: ${DOCS_URL}/docs/lambda/troubleshooting/rate-limit. The original error message is:+`.trim()+ );+ }+Log.error(error.stack);quit(1);}diff --git a/packages/lambda/src/functions/helpers/inspect-errors.ts b/packages/lambda/src/functions/helpers/inspect-errors.tsindex c160c49368..c96cad4ec8 100644--- a/packages/lambda/src/functions/helpers/inspect-errors.ts+++ b/packages/lambda/src/functions/helpers/inspect-errors.ts@@ -2,6 +2,7 @@ import {_Object} from '@aws-sdk/client-s3';import {Internals} from 'remotion';import {AwsRegion} from '../../pricing/aws-regions';import {getErrorKeyPrefix} from '../../shared/constants';+import {DOCS_URL} from '../../shared/docs-url';import {streamToString} from '../../shared/stream-to-string';import {lambdaReadFile} from './io';import {@@ -28,6 +29,10 @@ const getExplanation = (stack: string) => {);}+ if (stack.includes('TooManyRequestsException')) {+ return `AWS returned an "TooManyRequestsException" error message which could mean you reached the concurrency limit of AWS Lambda. You can increase the limit - read this troubleshooting page: ${DOCS_URL}/docs/lambda/troubleshooting/rate-limit`;+ }+if (errorIsOutOfSpaceError(stack)) {return 'Your lambda function reached the 512MB storage limit. Reduce the amount of space needed per lambda function. Feel free to reach out to #lambda Discord for help';}