🎥 Make videos programmatically with React
improve error handling of function already found
Jonny Burger3cfb952d5d49
diff --git a/packages/docs/docs/lambda-faq.md b/packages/docs/docs/lambda-faq.mdindex 56fab43097..63a41fadb5 100644--- a/packages/docs/docs/lambda-faq.md+++ b/packages/docs/docs/lambda-faq.md@@ -8,7 +8,12 @@ Some commonly asked questions about Remotion Lambda.### Do I need to deploy a function for each render?-No, you only need to deploy one function and it will be capable of rendering multiple videos, even across different projects.+No, in general you only need to deploy one function and it will be capable of rendering multiple videos, even across different projects. Trying to deploy multiple functions with the same version and region will result in an error.++There are two exceptions when it is possible to deploy multiple functions:++- If you are using multiple regions, you need to deploy a function for each region.+- If you are upgrading to a newer version of Remotion Lambda, you need to deploy a new function. You can then run the new and the old function side-by-side. The `@remotion/lambda` CLI will always choose the function in your AWS account that has the same version as the client package. If you use the [`getFunctions()`](/docs/lambda/getfunctions) Node.JS API, set the [`compatibleOnly`](/docs/lambda/getfunctions#compatibleonly) flag to `true` to filter out functions that don't match the version of the `@remotion/lambda` package.### Do I need to create multiple buckets?diff --git a/packages/lambda/remotionlambda.zip b/packages/lambda/remotionlambda.zipindex 2af67ab3da..fc8fc3c53d 100644Binary files a/packages/lambda/remotionlambda.zip and b/packages/lambda/remotionlambda.zip differdiff --git a/packages/lambda/src/api/deploy-function.ts b/packages/lambda/src/api/deploy-function.tsindex aba7990845..775bf78921 100644--- a/packages/lambda/src/api/deploy-function.ts+++ b/packages/lambda/src/api/deploy-function.ts@@ -1,6 +1,7 @@import {getFunctions} from '..';import {AwsRegion} from '../pricing/aws-regions';import {CURRENT_VERSION, RENDER_FN_PREFIX} from '../shared/constants';+import {DOCS_URL} from '../shared/docs-url';import {FUNCTION_ZIP} from '../shared/function-zip-path';import {getAccountId} from '../shared/get-account-id';import {randomHash} from '../shared/random-hash';@@ -42,7 +43,7 @@ export const deployFunction = async (options: {if (alreadyDeployed) {throw new Error(- `A function with version ${CURRENT_VERSION} is already deployed in region ${options.region}, it is called ${alreadyDeployed.functionName}`+ `Already found a function (${alreadyDeployed.functionName}) with version ${CURRENT_VERSION} deployed in region ${options.region}. You only need 1 function per region, see ${DOCS_URL}/docs/lambda/faq#do-i-need-to-deploy-a-function-for-each-render `);}diff --git a/packages/lambda/src/shared/check-credentials.ts b/packages/lambda/src/shared/check-credentials.tsindex f2650e2b41..be3b6708a1 100644--- a/packages/lambda/src/shared/check-credentials.ts+++ b/packages/lambda/src/shared/check-credentials.ts@@ -1,5 +1,7 @@+import {DOCS_URL} from './docs-url';+const messageForVariable = (variable: string) =>- `You have tried to call a Remotion Lambda function, but have not set the environment variable ${variable}. Please refer to the Remotion Lambda docs to see how to generate the credentials for your AWS account and then set the environment variables. Environment variables from a '.env' file are not automatically read if you are calling the Node.JS APIs, in that case you need to read the .env file yourself using the 'dotenv' package.`;+ `You have tried to call a Remotion Lambda function, but have not set the environment variable ${variable}. Please refer to the Remotion Lambda docs (${DOCS_URL}/docs/lambda/setup) to see how to generate the credentials for your AWS account and then set the environment variables. Environment variables from a '.env' file are not automatically read if you are calling the Node.JS APIs, in that case you need to read the .env file yourself using the 'dotenv' package.`;// TODO: Could better differentiate between CLI and Node.JS acccess.export const checkCredentials = () => {diff --git a/packages/lambda/src/shared/docs-url.ts b/packages/lambda/src/shared/docs-url.tsnew file mode 100644index 0000000000..ae31fe8050--- /dev/null+++ b/packages/lambda/src/shared/docs-url.ts@@ -0,0 +1 @@+export const DOCS_URL = 'https://remotion-lambda-alpha.netlify.app';