MCPcopy Index your code
hub / github.com/remotion-dev/remotion / executeCommand

Function executeCommand

packages/lambda/src/cli/index.ts:176–304  ·  view source on GitHub ↗
(
	args: string[],
	remotionRoot: string,
	logLevel: LogLevel,
	_providerSpecifics: ProviderSpecifics<AwsProvider> | null,
	fullClientSpecifics: FullClientSpecifics<AwsProvider> | null,
)

Source from the content-addressed store, hash-verified

174};
175
176export const executeCommand = async (
177 args: string[],
178 remotionRoot: string,
179 logLevel: LogLevel,
180 _providerSpecifics: ProviderSpecifics<AwsProvider> | null,
181 fullClientSpecifics: FullClientSpecifics<AwsProvider> | null,
182) => {
183 try {
184 const providerSpecifics =
185 _providerSpecifics ?? LambdaClientInternals.awsImplementation;
186 await matchCommand({
187 args,
188 remotionRoot,
189 logLevel,
190 providerSpecifics: providerSpecifics,
191 fullClientSpecifics: fullClientSpecifics ?? awsFullClientSpecifics,
192 });
193 } catch (err) {
194 const error = err as Error;
195 if (
196 error.message.includes(
197 'The role defined for the function cannot be assumed by Lambda',
198 )
199 ) {
200 if (parsedLambdaCli['custom-role-arn']) {
201 Log.error(
202 {indent: false, logLevel},
203 `
204 The role "${parsedLambdaCli['custom-role-arn']}" does not exist or has the wrong policy assigned to it. Do either:
205 - Remove the "--custom-role-arn" parameter and set up Remotion Lambda according to the setup guide
206 - Make sure the role has the same policy assigned as the one returned by "npx ${BINARY_NAME} ${POLICIES_COMMAND} ${ROLE_SUBCOMMAND}"
207
208 Revisit ${DOCS_URL}/docs/lambda/setup and make sure you set up the role and role policy correctly. Also see the troubleshooting page: ${DOCS_URL}/docs/lambda/troubleshooting/permissions. The original error message is:
209 `.trim(),
210 );
211 }
212
213 Log.error(
214 {indent: false, logLevel},
215 `
216The role "${ROLE_NAME}" does not exist in your AWS account or has the wrong policy assigned to it. Common reasons:
217- The name of the role is not "${ROLE_NAME}"
218- The policy is not exactly as specified in the setup guide
219
220Revisit ${DOCS_URL}/docs/lambda/setup and make sure you set up the role and role policy correctly. Also see the troubleshooting page: ${DOCS_URL}/docs/lambda/troubleshooting/permissions. The original error message is:
221`.trim(),
222 );
223 }
224
225 if (error.stack?.includes('AccessDenied')) {
226 Log.error(
227 {indent: false, logLevel},
228 `
229AWS returned an "AccessDenied" error message meaning a permission is missing. Read the permissions troubleshooting page: ${DOCS_URL}/docs/lambda/troubleshooting/permissions. The original error message is:
230`.trim(),
231 );
232 }
233

Callers 1

cliFunction · 0.70

Calls 3

quitFunction · 0.90
matchCommandFunction · 0.70
trimMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…