UnrecognizedClientException
如果在调用 renderMediaOnLambda() 或 renderStillOnLambda() 时遇到权限错误:
🌐 If you got a permission error while calling renderMediaOnLambda() or renderStillOnLambda():
UnrecognizedClientException: The AWS credentials provided were probably mixed up.这意味着 AWS 凭证是正确的,但不允许访问某个资源。
🌐 it means that the AWS credentials were correct, but don't allow access to a certain resource.
最常见的原因:在无服务器函数中调用 Remotion 函数
🌐 Most common cause: Calling a Remotion function inside a serverless function
在 AWS Lambda 函数或 Vercel 无服务器函数内部调用 render 时,该函数已经有其自己的 AWS_ACCESS_KEY_ID 和 AWS_SECRET_ACCESS_KEY 环境变量设置。然而,这些变量来自 AWS 本身,并且与 Remotion 用于调用无服务器函数的变量不同。
🌐 When calling render inside an AWS Lambda function or a Vercel serverless function, that function already has it's own AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables set. However, these are from AWS itself and are different from the variables that Remotion uses to invoke serverless functions.
为了避免冲突,你可以更改设置的环境变量名称:
🌐 To avoid that conflict, you can change the name of the environment variables you set:
- 将
AWS_ACCESS_KEY_ID重命名为REMOTION_AWS_ACCESS_KEY_ID - 将
AWS_SECRET_ACCESS_KEY重命名为REMOTION_AWS_SECRET_ACCESS_KEY
如果两者都设置了,Remotion 将优先使用以 REMOTION_ 为前缀的环境变量,这应该能很好地区分这两种不同的凭证。
🌐 If both are set, Remotion will prefer the environment variables that are prefixed with REMOTION_, which should separate the two different credentials nicely.