@remotion/lambda-client 4.0.364 → 4.0.365

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/esm/index.mjs +1 -1
  3. package/package.json +3 -3
  4. package/.turbo/turbo-formatting.log +0 -4
  5. package/.turbo/turbo-lint.log +0 -25
  6. package/.turbo/turbo-make.log +0 -3
  7. package/bundle.ts +0 -20
  8. package/dist/cjs/test/concurrency-payload.test.d.ts +0 -1
  9. package/dist/cjs/test/encode-aws-url.test.d.ts +0 -1
  10. package/dist/cjs/test/price-calculation.test.d.ts +0 -1
  11. package/dist/cjs/test/pricing.test.d.ts +0 -1
  12. package/dist/cjs/test/request-handler.test.d.ts +0 -1
  13. package/dist/cjs/test/validate-disk-size-in-mb.test.d.ts +0 -1
  14. package/dist/test/concurrency-payload.test.d.ts +0 -1
  15. package/dist/test/concurrency-payload.test.js +0 -119
  16. package/dist/test/encode-aws-url.test.d.ts +0 -1
  17. package/dist/test/encode-aws-url.test.js +0 -8
  18. package/dist/test/price-calculation.test.d.ts +0 -1
  19. package/dist/test/price-calculation.test.js +0 -62
  20. package/dist/test/pricing.test.d.ts +0 -1
  21. package/dist/test/pricing.test.js +0 -27
  22. package/dist/test/request-handler.test.d.ts +0 -1
  23. package/dist/test/request-handler.test.js +0 -36
  24. package/dist/test/validate-disk-size-in-mb.test.d.ts +0 -1
  25. package/dist/test/validate-disk-size-in-mb.test.js +0 -14
  26. package/dist/tsconfig.tsbuildinfo +0 -1
  27. package/eslint.config.mjs +0 -5
  28. package/src/app-router-webhook.ts +0 -73
  29. package/src/apply-lifecycle.ts +0 -30
  30. package/src/aws-clients.ts +0 -75
  31. package/src/aws-provider.ts +0 -139
  32. package/src/bucket-exists.ts +0 -35
  33. package/src/call-lambda-async.ts +0 -43
  34. package/src/call-lambda-streaming.ts +0 -226
  35. package/src/call-lambda-sync.ts +0 -59
  36. package/src/check-credentials.ts +0 -51
  37. package/src/clean-items.ts +0 -50
  38. package/src/constants.ts +0 -38
  39. package/src/content-disposition-header.ts +0 -64
  40. package/src/convert-to-serve-url.ts +0 -24
  41. package/src/create-bucket.ts +0 -87
  42. package/src/delete-file.ts +0 -38
  43. package/src/delete-function.ts +0 -28
  44. package/src/delete-render.ts +0 -114
  45. package/src/encode-aws-url-params.ts +0 -3
  46. package/src/estimate-price.ts +0 -95
  47. package/src/express-webhook.ts +0 -57
  48. package/src/get-account-id.ts +0 -22
  49. package/src/get-aws-client.ts +0 -63
  50. package/src/get-aws-urls.ts +0 -85
  51. package/src/get-buckets.ts +0 -84
  52. package/src/get-compositions-on-lambda.ts +0 -111
  53. package/src/get-credentials.ts +0 -81
  54. package/src/get-env-variable.ts +0 -15
  55. package/src/get-function-name.ts +0 -24
  56. package/src/get-function-version.ts +0 -49
  57. package/src/get-functions.ts +0 -114
  58. package/src/get-output-url-from-metadata.ts +0 -23
  59. package/src/get-render-progress.ts +0 -66
  60. package/src/get-s3-client.ts +0 -26
  61. package/src/get-service-client.ts +0 -195
  62. package/src/get-sites.ts +0 -136
  63. package/src/head-file.ts +0 -30
  64. package/src/index.ts +0 -152
  65. package/src/is-cli.ts +0 -7
  66. package/src/is-flaky-error.ts +0 -104
  67. package/src/is-in-lambda.ts +0 -5
  68. package/src/is-likely-to-have-aws-profile.ts +0 -55
  69. package/src/lambda-version-string.ts +0 -5
  70. package/src/lifecycle-rules.ts +0 -119
  71. package/src/lifecycle.ts +0 -44
  72. package/src/list-objects.ts +0 -87
  73. package/src/make-lambda-payload.ts +0 -328
  74. package/src/make-s3-url.ts +0 -13
  75. package/src/p-limit.ts +0 -75
  76. package/src/pages-router-webhook.ts +0 -68
  77. package/src/parse-function-name.ts +0 -24
  78. package/src/presign-url.ts +0 -121
  79. package/src/price-per-1s.ts +0 -863
  80. package/src/random-hash.ts +0 -10
  81. package/src/read-file.ts +0 -35
  82. package/src/regions.ts +0 -48
  83. package/src/render-media-on-lambda.ts +0 -227
  84. package/src/render-still-on-lambda.ts +0 -209
  85. package/src/runtime-preference.ts +0 -7
  86. package/src/speculate-function-name.ts +0 -60
  87. package/src/test/concurrency-payload.test.ts +0 -121
  88. package/src/test/encode-aws-url.test.ts +0 -7
  89. package/src/test/price-calculation.test.ts +0 -62
  90. package/src/test/pricing.test.ts +0 -32
  91. package/src/test/request-handler.test.ts +0 -42
  92. package/src/test/validate-disk-size-in-mb.test.ts +0 -15
  93. package/src/types.ts +0 -7
  94. package/src/validate-aws-region.ts +0 -14
  95. package/src/validate-bucketname.ts +0 -24
  96. package/src/validate-disk-size-in-mb.ts +0 -37
  97. package/src/validate-lambda-codec.ts +0 -28
  98. package/src/validate-memory-size.ts +0 -31
  99. package/src/validate-presign-expiration.ts +0 -46
  100. package/src/validate-serveurl.ts +0 -9
  101. package/src/validate-webhook-signature.ts +0 -42
  102. package/src/write-file.ts +0 -108
  103. package/tsconfig.json +0 -10
@@ -1,63 +0,0 @@
1
- import * as CloudWatchSDK from '@aws-sdk/client-cloudwatch-logs';
2
- import * as IamSdk from '@aws-sdk/client-iam';
3
- import * as LambdaSDK from '@aws-sdk/client-lambda';
4
- import * as S3SDK from '@aws-sdk/client-s3';
5
- import * as ServiceQuotasSDK from '@aws-sdk/client-service-quotas';
6
- import * as StsSdk from '@aws-sdk/client-sts';
7
- import type {CustomCredentials} from '@remotion/serverless-client';
8
- import type {AwsProvider} from './aws-provider';
9
- import {getServiceClient, type ServiceMapping} from './get-service-client';
10
- import type {AwsRegion} from './regions';
11
- import type {RequestHandler} from './types';
12
-
13
- export type GetAwsClientInput<T extends keyof ServiceMapping> = {
14
- region: AwsRegion;
15
- service: T;
16
- customCredentials?: CustomCredentials<AwsProvider> | null;
17
- forcePathStyle?: boolean;
18
- requestHandler?: RequestHandler;
19
- };
20
-
21
- type SdkMapping = {
22
- s3: typeof S3SDK;
23
- cloudwatch: typeof CloudWatchSDK;
24
- iam: typeof IamSdk;
25
- lambda: typeof LambdaSDK;
26
- servicequotas: typeof ServiceQuotasSDK;
27
- sts: typeof StsSdk;
28
- };
29
-
30
- export type GetAwsClientOutput<T extends keyof ServiceMapping> = {
31
- client: ServiceMapping[T];
32
- sdk: SdkMapping[T];
33
- };
34
-
35
- /*
36
- * @description Exposes full access to the AWS SDK used by Remotion, allowing interaction with AWS infrastructure beyond provided functionalities.
37
- * @see [Documentation](https://remotion.dev/docs/lambda/getawsclient)
38
- */
39
- export const getAwsClient = <T extends keyof ServiceMapping>({
40
- region,
41
- service,
42
- customCredentials,
43
- forcePathStyle,
44
- requestHandler,
45
- }: GetAwsClientInput<T>): GetAwsClientOutput<T> => {
46
- return {
47
- client: getServiceClient({
48
- region,
49
- service,
50
- customCredentials: customCredentials ?? null,
51
- forcePathStyle: forcePathStyle ?? false,
52
- requestHandler,
53
- }),
54
- sdk: {
55
- lambda: LambdaSDK,
56
- cloudwatch: CloudWatchSDK,
57
- iam: IamSdk,
58
- s3: S3SDK,
59
- servicequotas: ServiceQuotasSDK,
60
- sts: StsSdk,
61
- }[service],
62
- };
63
- };
@@ -1,85 +0,0 @@
1
- import type {
2
- GetLoggingUrlForRendererFunction,
3
- ServerlessRoutines,
4
- } from '@remotion/serverless-client';
5
- import type {AwsProvider} from './aws-provider';
6
- import {encodeAwsUrlParams} from './encode-aws-url-params';
7
- import type {AwsRegion} from './regions';
8
-
9
- const cloudWatchUrlWithQuery = ({
10
- region,
11
- functionNameToUse,
12
- query,
13
- }: {
14
- region: AwsRegion;
15
- functionNameToUse: string;
16
- query: string;
17
- }) => {
18
- return `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#logsV2:log-groups/log-group/$252Faws$252Flambda$252F${functionNameToUse}/log-events$3FfilterPattern$3D${encodeAwsUrlParams(
19
- query,
20
- )}`;
21
- };
22
-
23
- export const getCloudwatchMethodUrl = ({
24
- region,
25
- functionName,
26
- renderId,
27
- rendererFunctionName,
28
- method,
29
- }: {
30
- region: AwsRegion;
31
- functionName: string;
32
- method: ServerlessRoutines;
33
- rendererFunctionName: string | null;
34
- renderId: string;
35
- }) => {
36
- const functionNameToUse = rendererFunctionName ?? functionName;
37
- const query = `"method=${method},renderId=${renderId}"`;
38
-
39
- return cloudWatchUrlWithQuery({region, functionNameToUse, query});
40
- };
41
-
42
- export const getLambdaInsightsUrl = ({
43
- region,
44
- functionName,
45
- }: {
46
- region: AwsRegion;
47
- functionName: string;
48
- }) => {
49
- return `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#lambda-insights:functions/${functionName}`;
50
- };
51
-
52
- export const getCloudwatchRendererUrl: GetLoggingUrlForRendererFunction<
53
- AwsProvider
54
- > = ({region, functionName, renderId, rendererFunctionName, chunk}) => {
55
- const functionNameToUse = rendererFunctionName ?? functionName;
56
- const query = `"method=renderer,renderId=${renderId}${
57
- chunk === null ? '' : `,chunk=${chunk},`
58
- }"`;
59
-
60
- return cloudWatchUrlWithQuery({region, functionNameToUse, query});
61
- };
62
-
63
- export const getS3RenderUrl = ({
64
- renderId,
65
- region,
66
- bucketName,
67
- }: {
68
- renderId: string;
69
- region: AwsRegion;
70
- bucketName: string;
71
- }) => {
72
- return `https://s3.console.aws.amazon.com/s3/buckets/${bucketName}?region=${region}&prefix=renders/${renderId}/`;
73
- };
74
-
75
- export const getProgressJsonUrl = ({
76
- region,
77
- bucketName,
78
- renderId,
79
- }: {
80
- region: AwsRegion;
81
- bucketName: string;
82
- renderId: string;
83
- }) => {
84
- return `https://${region}.console.aws.amazon.com/s3/object/${bucketName}?region=${region}&bucketType=general&prefix=renders/${renderId}/progress.json`;
85
- };
@@ -1,84 +0,0 @@
1
- import {GetBucketLocationCommand, ListBucketsCommand} from '@aws-sdk/client-s3';
2
- import type {ProviderSpecifics} from '@remotion/serverless-client';
3
- import type {AwsProvider} from './aws-provider';
4
- import {REMOTION_BUCKET_PREFIX} from './constants';
5
- import {getS3Client} from './get-s3-client';
6
- import type {AwsRegion} from './regions';
7
- import {parseBucketName} from './validate-bucketname';
8
-
9
- export type BucketWithLocation = {
10
- name: string;
11
- creationDate: number;
12
- region: AwsRegion;
13
- };
14
-
15
- export const getRemotionBuckets: ProviderSpecifics<AwsProvider>['getBuckets'] =
16
- async ({
17
- region,
18
- forceBucketName,
19
- forcePathStyle,
20
- requestHandler,
21
- }): Promise<BucketWithLocation[]> => {
22
- const {Buckets} = await getS3Client({
23
- region,
24
- customCredentials: null,
25
- forcePathStyle,
26
- requestHandler,
27
- }).send(new ListBucketsCommand({}));
28
- if (!Buckets) {
29
- return [];
30
- }
31
-
32
- const remotionBuckets = Buckets.filter((b) => {
33
- if (forceBucketName) {
34
- return b.Name === forceBucketName;
35
- }
36
-
37
- return b.Name?.startsWith(REMOTION_BUCKET_PREFIX);
38
- });
39
-
40
- const locations = await Promise.all(
41
- remotionBuckets.map(async (bucket) => {
42
- const {region: parsedRegion} = parseBucketName(bucket.Name as string);
43
- if (parsedRegion) {
44
- return parsedRegion;
45
- }
46
-
47
- try {
48
- const result = await getS3Client({
49
- region,
50
- customCredentials: null,
51
- forcePathStyle,
52
- requestHandler,
53
- }).send(
54
- new GetBucketLocationCommand({
55
- Bucket: bucket.Name as string,
56
- }),
57
- );
58
- // AWS docs: Buckets in Region us-east-1 have a LocationConstraint of null!!
59
- return result.LocationConstraint ?? ('us-east-1' as AwsRegion);
60
- } catch (err) {
61
- // Sometimes the API returns a bucket even if it was deleted before
62
- if ((err as Error).stack?.includes('NoSuchBucket')) {
63
- return null;
64
- }
65
-
66
- throw err;
67
- }
68
- }),
69
- );
70
-
71
- const bucketsWithLocation = remotionBuckets
72
- .map((bucket, i): BucketWithLocation => {
73
- return {
74
- creationDate: (bucket.CreationDate as Date).getTime(),
75
- name: bucket.Name as string,
76
- region: locations[i] as AwsRegion,
77
- };
78
- })
79
- .filter((b) => b.region);
80
-
81
- return bucketsWithLocation.filter((bucket) => {
82
- return bucket.region === region;
83
- });
84
- };
@@ -1,111 +0,0 @@
1
- import type {
2
- BrowserSafeApis,
3
- ChromiumOptions,
4
- ToOptions,
5
- VideoConfig,
6
- } from '@remotion/serverless-client';
7
- import {
8
- ServerlessRoutines,
9
- VERSION,
10
- compressInputProps,
11
- getNeedsToUpload,
12
- serializeOrThrow,
13
- } from '@remotion/serverless-client';
14
- import {awsImplementation} from './aws-provider';
15
- import type {AwsRegion} from './regions';
16
- import type {RequestHandler} from './types';
17
-
18
- export type GetCompositionsOnLambdaInput = {
19
- chromiumOptions?: ChromiumOptions;
20
- region: AwsRegion;
21
- inputProps: Record<string, unknown>;
22
- functionName: string;
23
- serveUrl: string;
24
- envVariables?: Record<string, string>;
25
- forceBucketName?: string;
26
- /**
27
- * @deprecated in favor of `logLevel`: true
28
- */
29
- dumpBrowserLogs?: boolean;
30
- forcePathStyle?: boolean;
31
- requestHandler?: RequestHandler | null;
32
- } & Partial<
33
- ToOptions<typeof BrowserSafeApis.optionsMap.getCompositionsOnLambda>
34
- >;
35
-
36
- export type GetCompositionsOnLambdaOutput = VideoConfig[];
37
-
38
- /*
39
- * @description Gets the compositions inside a Lambda function.
40
- * @see [Documentation](https://remotion.dev/docs/lambda/getcompositionsonlambda)
41
- */
42
- export const getCompositionsOnLambda = async ({
43
- chromiumOptions,
44
- serveUrl,
45
- region,
46
- inputProps,
47
- functionName,
48
- envVariables,
49
- logLevel,
50
- timeoutInMilliseconds,
51
- forceBucketName: bucketName,
52
- dumpBrowserLogs,
53
- offthreadVideoCacheSizeInBytes,
54
- forcePathStyle,
55
- requestHandler,
56
- mediaCacheSizeInBytes,
57
- }: GetCompositionsOnLambdaInput): Promise<GetCompositionsOnLambdaOutput> => {
58
- const stringifiedInputProps = serializeOrThrow(inputProps, 'input-props');
59
-
60
- const serializedInputProps = await compressInputProps({
61
- stringifiedInputProps,
62
- region,
63
- userSpecifiedBucketName: bucketName ?? null,
64
- propsType: 'input-props',
65
- needsToUpload: getNeedsToUpload({
66
- type: 'video-or-audio',
67
- sizes: [
68
- stringifiedInputProps.length,
69
- JSON.stringify(envVariables).length,
70
- ],
71
- providerSpecifics: awsImplementation,
72
- }),
73
- providerSpecifics: awsImplementation,
74
- forcePathStyle: forcePathStyle ?? false,
75
- skipPutAcl: false,
76
- requestHandler,
77
- });
78
-
79
- try {
80
- const res = await awsImplementation.callFunctionSync({
81
- functionName,
82
- type: ServerlessRoutines.compositions,
83
- payload: {
84
- type: ServerlessRoutines.compositions,
85
- chromiumOptions: chromiumOptions ?? {},
86
- serveUrl,
87
- envVariables,
88
- inputProps: serializedInputProps,
89
- logLevel: dumpBrowserLogs ? 'verbose' : (logLevel ?? 'info'),
90
- timeoutInMilliseconds: timeoutInMilliseconds ?? 30000,
91
- version: VERSION,
92
- bucketName: bucketName ?? null,
93
- offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes ?? null,
94
- forcePathStyle: forcePathStyle ?? false,
95
- mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
96
- },
97
- region,
98
- timeoutInTest: 120000,
99
- requestHandler,
100
- });
101
- return res.compositions;
102
- } catch (err) {
103
- if ((err as Error).stack?.includes('UnrecognizedClientException')) {
104
- throw new Error(
105
- 'UnrecognizedClientException: The AWS credentials provided were probably mixed up. Learn how to fix this issue here: https://remotion.dev/docs/lambda/troubleshooting/unrecognizedclientexception',
106
- );
107
- }
108
-
109
- throw err;
110
- }
111
- };
@@ -1,81 +0,0 @@
1
- import {fromIni} from '@aws-sdk/credential-provider-ini';
2
- import {getEnvVariable} from './get-env-variable';
3
- import {isInsideLambda} from './is-in-lambda';
4
-
5
- type CredentialPair = {
6
- accessKeyId: string;
7
- secretAccessKey: string;
8
- sessionToken?: string;
9
- };
10
- type AwsCredentialIdentityProvider = ReturnType<typeof fromIni>;
11
-
12
- export const getCredentials = ():
13
- | CredentialPair
14
- | AwsCredentialIdentityProvider
15
- | undefined => {
16
- if (isInsideLambda()) {
17
- return undefined;
18
- }
19
-
20
- if (getEnvVariable('REMOTION_AWS_PROFILE')) {
21
- return fromIni({
22
- profile: getEnvVariable('REMOTION_AWS_PROFILE'),
23
- });
24
- }
25
-
26
- if (
27
- getEnvVariable('REMOTION_AWS_ACCESS_KEY_ID') &&
28
- getEnvVariable('REMOTION_AWS_SECRET_ACCESS_KEY') &&
29
- getEnvVariable('REMOTION_AWS_SESSION_TOKEN')
30
- ) {
31
- return {
32
- accessKeyId: getEnvVariable('REMOTION_AWS_ACCESS_KEY_ID') as string,
33
- secretAccessKey: getEnvVariable(
34
- 'REMOTION_AWS_SECRET_ACCESS_KEY',
35
- ) as string,
36
- sessionToken: getEnvVariable('REMOTION_AWS_SESSION_TOKEN') as string,
37
- };
38
- }
39
-
40
- if (
41
- getEnvVariable('REMOTION_AWS_ACCESS_KEY_ID') &&
42
- getEnvVariable('REMOTION_AWS_SECRET_ACCESS_KEY')
43
- ) {
44
- return {
45
- accessKeyId: getEnvVariable('REMOTION_AWS_ACCESS_KEY_ID') as string,
46
- secretAccessKey: getEnvVariable(
47
- 'REMOTION_AWS_SECRET_ACCESS_KEY',
48
- ) as string,
49
- };
50
- }
51
-
52
- if (getEnvVariable('AWS_PROFILE')) {
53
- return fromIni({
54
- profile: getEnvVariable('AWS_PROFILE'),
55
- });
56
- }
57
-
58
- if (
59
- getEnvVariable('AWS_ACCESS_KEY_ID') &&
60
- getEnvVariable('AWS_SECRET_ACCESS_KEY') &&
61
- getEnvVariable('AWS_SESSION_TOKEN')
62
- ) {
63
- return {
64
- accessKeyId: getEnvVariable('AWS_ACCESS_KEY_ID') as string,
65
- secretAccessKey: getEnvVariable('AWS_SECRET_ACCESS_KEY') as string,
66
- sessionToken: getEnvVariable('AWS_SESSION_TOKEN') as string,
67
- };
68
- }
69
-
70
- if (
71
- getEnvVariable('AWS_ACCESS_KEY_ID') &&
72
- getEnvVariable('AWS_SECRET_ACCESS_KEY')
73
- ) {
74
- return {
75
- accessKeyId: getEnvVariable('AWS_ACCESS_KEY_ID') as string,
76
- secretAccessKey: getEnvVariable('AWS_SECRET_ACCESS_KEY') as string,
77
- };
78
- }
79
-
80
- return undefined;
81
- };
@@ -1,15 +0,0 @@
1
- export const getEnvVariable = (name: string) => {
2
- if (
3
- typeof process !== 'undefined' &&
4
- typeof process.env !== 'undefined' &&
5
- process.env[name]
6
- ) {
7
- return process.env[name];
8
- }
9
-
10
- if (typeof Deno !== 'undefined' && Deno.env.has(name)) {
11
- return Deno.env.get(name);
12
- }
13
-
14
- return undefined;
15
- };
@@ -1,24 +0,0 @@
1
- import {RENDER_FN_PREFIX} from './constants';
2
-
3
- type ReturnType = {
4
- version: string;
5
- memorySizeInMb: number;
6
- diskSizeInMb: number;
7
- timeoutInSeconds: number;
8
- };
9
-
10
- export const parseFunctionName = (functionName: string): ReturnType | null => {
11
- const match = functionName.match(
12
- new RegExp(RENDER_FN_PREFIX + '(.*)-mem(\\d+)mb-disk(\\d+)mb-(\\d+)sec$'),
13
- );
14
- if (!match) {
15
- return null;
16
- }
17
-
18
- return {
19
- version: match[1],
20
- memorySizeInMb: parseInt(match[2], 10),
21
- diskSizeInMb: parseInt(match[3], 10),
22
- timeoutInSeconds: parseInt(match[4], 10),
23
- };
24
- };
@@ -1,49 +0,0 @@
1
- import type {LogLevel} from '@remotion/serverless-client';
2
- import {
3
- COMMAND_NOT_FOUND,
4
- ServerlessRoutines,
5
- } from '@remotion/serverless-client';
6
- import {awsImplementation} from './aws-provider';
7
- import type {AwsRegion} from './regions';
8
- import type {RequestHandler} from './types';
9
-
10
- export const getFunctionVersion = async ({
11
- functionName,
12
- region,
13
- logLevel,
14
- requestHandler,
15
- }: {
16
- functionName: string;
17
- region: AwsRegion;
18
- logLevel: LogLevel;
19
- requestHandler: RequestHandler | null | undefined;
20
- }): Promise<string> => {
21
- try {
22
- // For now, we'll pass requestHandler to the awsImplementation if needed
23
- // This might require deeper changes in the serverless-client framework
24
- const result = await awsImplementation.callFunctionSync({
25
- functionName,
26
- payload: {
27
- logLevel,
28
- type: ServerlessRoutines.info,
29
- },
30
- region,
31
- type: ServerlessRoutines.info,
32
- timeoutInTest: 120000,
33
- requestHandler,
34
- });
35
- return result.version;
36
- } catch (err) {
37
- // Prerelease versions had no info command
38
- if ((err as Error).message.includes(COMMAND_NOT_FOUND)) {
39
- return 'n/a';
40
- }
41
-
42
- // Bug in certain version of AWS S3 kit
43
- if ((err as Error).message.includes('AWS CRT binary not present ')) {
44
- return 'n/a';
45
- }
46
-
47
- throw err;
48
- }
49
- };
@@ -1,114 +0,0 @@
1
- import type {FunctionConfiguration} from '@aws-sdk/client-lambda';
2
- import {ListFunctionsCommand} from '@aws-sdk/client-lambda';
3
- import type {FunctionInfo, LogLevel} from '@remotion/serverless-client';
4
- import {VERSION} from '@remotion/serverless-client';
5
- import {getLambdaClient} from './aws-clients';
6
- import {DEFAULT_EPHEMERAL_STORAGE_IN_MB, RENDER_FN_PREFIX} from './constants';
7
- import {getFunctionVersion} from './get-function-version';
8
- import type {AwsRegion} from './regions';
9
- import type {RequestHandler} from './types';
10
-
11
- export type GetFunctionsInput = {
12
- region: AwsRegion;
13
- compatibleOnly: boolean;
14
- logLevel?: LogLevel;
15
- requestHandler?: RequestHandler;
16
- };
17
-
18
- const getAllFunctions = async ({
19
- existing,
20
- nextMarker,
21
- region,
22
- requestHandler,
23
- }: {
24
- existing: FunctionConfiguration[];
25
- nextMarker: string | null;
26
- region: AwsRegion;
27
- requestHandler?: RequestHandler;
28
- }): Promise<FunctionConfiguration[]> => {
29
- const allLambdas: FunctionConfiguration[] = [...existing];
30
- const lambdas = await getLambdaClient(
31
- region,
32
- undefined,
33
- requestHandler ?? null,
34
- ).send(
35
- new ListFunctionsCommand({
36
- Marker: nextMarker ?? undefined,
37
- }),
38
- );
39
- if (!lambdas.Functions) {
40
- return allLambdas;
41
- }
42
-
43
- for (const lambda of lambdas.Functions) {
44
- allLambdas.push(lambda);
45
- }
46
-
47
- if (lambdas.NextMarker) {
48
- return getAllFunctions({
49
- existing: allLambdas,
50
- nextMarker: lambdas.NextMarker,
51
- region,
52
- requestHandler,
53
- });
54
- }
55
-
56
- return allLambdas;
57
- };
58
-
59
- /*
60
- * @description Retrieves a list of functions that Remotion deployed to AWS Lambda in a certain region.
61
- * @see [Documentation](https://remotion.dev/docs/lambda/getfunctions)
62
- */
63
- export const getFunctions = async (
64
- params: GetFunctionsInput,
65
- ): Promise<FunctionInfo[]> => {
66
- const lambdas = await getAllFunctions({
67
- existing: [],
68
- nextMarker: null,
69
- region: params.region,
70
- requestHandler: params.requestHandler,
71
- });
72
-
73
- const remotionLambdas = lambdas.filter((f) => {
74
- return f.FunctionName?.startsWith(RENDER_FN_PREFIX);
75
- });
76
-
77
- const configs = await Promise.all(
78
- remotionLambdas.map(async (fn) => {
79
- try {
80
- const version = await getFunctionVersion({
81
- functionName: fn.FunctionName as string,
82
- region: params.region,
83
- logLevel: params.logLevel ?? 'info',
84
- requestHandler: params.requestHandler,
85
- });
86
- return version;
87
- } catch {
88
- return null;
89
- }
90
- }),
91
- );
92
-
93
- const list = remotionLambdas.map((lambda, i): FunctionInfo => {
94
- return {
95
- functionName: lambda.FunctionName as string,
96
- version: configs[i],
97
- memorySizeInMb: lambda.MemorySize as number,
98
- timeoutInSeconds: lambda.Timeout as number,
99
- diskSizeInMb:
100
- lambda.EphemeralStorage?.Size ?? DEFAULT_EPHEMERAL_STORAGE_IN_MB,
101
- };
102
- });
103
- if (!params.compatibleOnly) {
104
- return list;
105
- }
106
-
107
- return list.filter((l) => {
108
- if (!params.compatibleOnly) {
109
- return true;
110
- }
111
-
112
- return l.version === VERSION;
113
- });
114
- };
@@ -1,23 +0,0 @@
1
- import type {GetOutputUrl} from '@remotion/serverless-client';
2
- import {getExpectedOutName} from '@remotion/serverless-client';
3
- import type {AwsProvider} from './aws-provider';
4
- import {REMOTION_BUCKET_PREFIX} from './constants';
5
-
6
- export const getOutputUrlFromMetadata: GetOutputUrl<AwsProvider> = ({
7
- renderMetadata,
8
- bucketName,
9
- customCredentials,
10
- currentRegion,
11
- }) => {
12
- const {key, renderBucketName} = getExpectedOutName({
13
- renderMetadata,
14
- bucketName,
15
- customCredentials,
16
- bucketNamePrefix: REMOTION_BUCKET_PREFIX,
17
- });
18
-
19
- return {
20
- url: `https://s3.${currentRegion}.amazonaws.com/${renderBucketName}/${key}`,
21
- key,
22
- };
23
- };