@remotion/lambda-client 4.0.363 → 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.
- package/dist/cjs/app-router-webhook.d.ts +10 -0
- package/dist/cjs/apply-lifecycle.d.ts +8 -0
- package/dist/cjs/aws-clients.d.ts +12 -0
- package/dist/cjs/aws-provider.d.ts +27 -0
- package/dist/cjs/bucket-exists.d.ts +3 -0
- package/dist/cjs/call-lambda-async.d.ts +2 -0
- package/dist/cjs/call-lambda-streaming.d.ts +6 -0
- package/dist/cjs/call-lambda-sync.d.ts +2 -0
- package/dist/cjs/check-credentials.d.ts +1 -0
- package/dist/cjs/clean-items.d.ts +17 -0
- package/dist/cjs/constants.d.ts +25 -0
- package/dist/cjs/constants.js +75 -0
- package/dist/cjs/content-disposition-header.d.ts +2 -0
- package/dist/cjs/convert-to-serve-url.d.ts +6 -0
- package/dist/cjs/create-bucket.d.ts +3 -0
- package/dist/cjs/delete-file.d.ts +3 -0
- package/dist/cjs/delete-function.d.ts +7 -0
- package/dist/cjs/delete-render.d.ts +22 -0
- package/dist/cjs/encode-aws-url-params.d.ts +1 -0
- package/dist/cjs/estimate-price.d.ts +17 -0
- package/dist/cjs/express-webhook.d.ts +3 -0
- package/dist/cjs/get-account-id.d.ts +3 -0
- package/dist/cjs/get-aws-client.d.ts +32 -0
- package/dist/cjs/get-aws-urls.d.ts +25 -0
- package/dist/cjs/get-buckets.d.ts +9 -0
- package/dist/cjs/get-compositions-on-lambda.d.ts +20 -0
- package/dist/cjs/get-credentials.d.ts +9 -0
- package/dist/cjs/get-env-variable.d.ts +1 -0
- package/dist/cjs/get-function-name.d.ts +8 -0
- package/dist/cjs/get-function-version.d.ts +9 -0
- package/dist/cjs/get-functions.d.ts +10 -0
- package/dist/cjs/get-output-url-from-metadata.d.ts +3 -0
- package/dist/cjs/get-render-progress.d.ts +17 -0
- package/dist/cjs/get-s3-client.d.ts +11 -0
- package/dist/cjs/get-service-client.d.ts +25 -0
- package/dist/cjs/get-sites.d.ts +31 -0
- package/dist/cjs/head-file.d.ts +3 -0
- package/dist/cjs/index.d.ts +129 -0
- package/dist/cjs/index.js +72692 -0
- package/dist/cjs/is-cli.d.ts +2 -0
- package/dist/cjs/is-flaky-error.d.ts +1 -0
- package/dist/cjs/is-in-lambda.d.ts +1 -0
- package/dist/cjs/is-likely-to-have-aws-profile.d.ts +1 -0
- package/dist/cjs/lambda-version-string.d.ts +1 -0
- package/dist/cjs/lifecycle-rules.d.ts +12 -0
- package/dist/cjs/lifecycle.d.ts +7 -0
- package/dist/cjs/list-objects.d.ts +3 -0
- package/dist/cjs/make-lambda-payload.d.ts +59 -0
- package/dist/cjs/make-s3-url.d.ts +6 -0
- package/dist/cjs/p-limit.d.ts +1 -0
- package/dist/cjs/pages-router-webhook.d.ts +5 -0
- package/dist/cjs/parse-function-name.d.ts +8 -0
- package/dist/cjs/presign-url.d.ts +17 -0
- package/dist/cjs/price-per-1s.d.ts +37 -0
- package/dist/cjs/random-hash.d.ts +1 -0
- package/dist/cjs/read-file.d.ts +11 -0
- package/dist/cjs/regions.d.ts +3 -0
- package/dist/cjs/regions.js +80 -0
- package/dist/cjs/render-media-on-lambda.d.ts +66 -0
- package/dist/cjs/render-still-on-lambda.d.ts +61 -0
- package/dist/cjs/runtime-preference.d.ts +2 -0
- package/dist/cjs/speculate-function-name.d.ts +7 -0
- package/dist/cjs/types.d.ts +4 -0
- package/dist/cjs/validate-aws-region.d.ts +2 -0
- package/dist/cjs/validate-bucketname.d.ts +4 -0
- package/dist/cjs/validate-disk-size-in-mb.d.ts +1 -0
- package/dist/cjs/validate-lambda-codec.d.ts +2 -0
- package/dist/cjs/validate-memory-size.d.ts +1 -0
- package/dist/cjs/validate-presign-expiration.d.ts +1 -0
- package/dist/cjs/validate-serveurl.d.ts +1 -0
- package/dist/cjs/validate-webhook-signature.d.ts +5 -0
- package/dist/cjs/write-file.d.ts +5 -0
- package/dist/esm/index.mjs +64284 -13659
- package/package.json +15 -16
- package/.turbo/turbo-formatting.log +0 -4
- package/.turbo/turbo-lint.log +0 -25
- package/.turbo/turbo-make.log +0 -3
- package/bundle.ts +0 -24
- package/dist/test/concurrency-payload.test.d.ts +0 -1
- package/dist/test/concurrency-payload.test.js +0 -119
- package/dist/test/encode-aws-url.test.d.ts +0 -1
- package/dist/test/encode-aws-url.test.js +0 -8
- package/dist/test/price-calculation.test.d.ts +0 -1
- package/dist/test/price-calculation.test.js +0 -62
- package/dist/test/pricing.test.d.ts +0 -1
- package/dist/test/pricing.test.js +0 -27
- package/dist/test/request-handler.test.d.ts +0 -1
- package/dist/test/request-handler.test.js +0 -36
- package/dist/test/validate-disk-size-in-mb.test.d.ts +0 -1
- package/dist/test/validate-disk-size-in-mb.test.js +0 -14
- package/eslint.config.mjs +0 -5
- package/src/app-router-webhook.ts +0 -73
- package/src/apply-lifecycle.ts +0 -30
- package/src/aws-clients.ts +0 -75
- package/src/aws-provider.ts +0 -139
- package/src/bucket-exists.ts +0 -35
- package/src/call-lambda-async.ts +0 -43
- package/src/call-lambda-streaming.ts +0 -226
- package/src/call-lambda-sync.ts +0 -59
- package/src/check-credentials.ts +0 -51
- package/src/clean-items.ts +0 -50
- package/src/constants.ts +0 -38
- package/src/content-disposition-header.ts +0 -64
- package/src/convert-to-serve-url.ts +0 -24
- package/src/create-bucket.ts +0 -87
- package/src/delete-file.ts +0 -38
- package/src/delete-function.ts +0 -28
- package/src/delete-render.ts +0 -114
- package/src/encode-aws-url-params.ts +0 -3
- package/src/estimate-price.ts +0 -95
- package/src/express-webhook.ts +0 -57
- package/src/get-account-id.ts +0 -22
- package/src/get-aws-client.ts +0 -63
- package/src/get-aws-urls.ts +0 -85
- package/src/get-buckets.ts +0 -84
- package/src/get-compositions-on-lambda.ts +0 -111
- package/src/get-credentials.ts +0 -81
- package/src/get-env-variable.ts +0 -15
- package/src/get-function-name.ts +0 -24
- package/src/get-function-version.ts +0 -49
- package/src/get-functions.ts +0 -114
- package/src/get-output-url-from-metadata.ts +0 -23
- package/src/get-render-progress.ts +0 -66
- package/src/get-s3-client.ts +0 -26
- package/src/get-service-client.ts +0 -195
- package/src/get-sites.ts +0 -136
- package/src/head-file.ts +0 -30
- package/src/index.ts +0 -152
- package/src/is-cli.ts +0 -7
- package/src/is-flaky-error.ts +0 -104
- package/src/is-in-lambda.ts +0 -5
- package/src/is-likely-to-have-aws-profile.ts +0 -55
- package/src/lambda-version-string.ts +0 -5
- package/src/lifecycle-rules.ts +0 -119
- package/src/lifecycle.ts +0 -44
- package/src/list-objects.ts +0 -87
- package/src/make-lambda-payload.ts +0 -328
- package/src/make-s3-url.ts +0 -13
- package/src/p-limit.ts +0 -75
- package/src/pages-router-webhook.ts +0 -68
- package/src/parse-function-name.ts +0 -24
- package/src/presign-url.ts +0 -121
- package/src/price-per-1s.ts +0 -863
- package/src/random-hash.ts +0 -10
- package/src/read-file.ts +0 -35
- package/src/regions.ts +0 -48
- package/src/render-media-on-lambda.ts +0 -227
- package/src/render-still-on-lambda.ts +0 -209
- package/src/runtime-preference.ts +0 -7
- package/src/speculate-function-name.ts +0 -60
- package/src/test/concurrency-payload.test.ts +0 -121
- package/src/test/encode-aws-url.test.ts +0 -7
- package/src/test/price-calculation.test.ts +0 -62
- package/src/test/pricing.test.ts +0 -32
- package/src/test/request-handler.test.ts +0 -42
- package/src/test/validate-disk-size-in-mb.test.ts +0 -15
- package/src/types.ts +0 -7
- package/src/validate-aws-region.ts +0 -14
- package/src/validate-bucketname.ts +0 -24
- package/src/validate-disk-size-in-mb.ts +0 -37
- package/src/validate-lambda-codec.ts +0 -28
- package/src/validate-memory-size.ts +0 -31
- package/src/validate-presign-expiration.ts +0 -46
- package/src/validate-serveurl.ts +0 -9
- package/src/validate-webhook-signature.ts +0 -42
- package/src/write-file.ts +0 -108
- package/tsconfig.json +0 -9
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import {CloudWatchLogsClient} from '@aws-sdk/client-cloudwatch-logs';
|
|
2
|
-
import {IAMClient} from '@aws-sdk/client-iam';
|
|
3
|
-
import {LambdaClient} from '@aws-sdk/client-lambda';
|
|
4
|
-
import {S3Client} from '@aws-sdk/client-s3';
|
|
5
|
-
import {ServiceQuotasClient} from '@aws-sdk/client-service-quotas';
|
|
6
|
-
import {STSClient} from '@aws-sdk/client-sts';
|
|
7
|
-
import type {CustomCredentials} from '@remotion/serverless-client';
|
|
8
|
-
import {MAX_FUNCTIONS_PER_RENDER, random} from '@remotion/serverless-client';
|
|
9
|
-
import type {AwsProvider} from './aws-provider';
|
|
10
|
-
import {checkCredentials} from './check-credentials';
|
|
11
|
-
import {getCredentials} from './get-credentials';
|
|
12
|
-
import {getEnvVariable} from './get-env-variable';
|
|
13
|
-
import type {AwsRegion} from './regions';
|
|
14
|
-
import type {RequestHandler} from './types';
|
|
15
|
-
|
|
16
|
-
export type ServiceMapping = {
|
|
17
|
-
s3: S3Client;
|
|
18
|
-
cloudwatch: CloudWatchLogsClient;
|
|
19
|
-
iam: IAMClient;
|
|
20
|
-
lambda: LambdaClient;
|
|
21
|
-
servicequotas: ServiceQuotasClient;
|
|
22
|
-
sts: STSClient;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const getCredentialsHash = ({
|
|
26
|
-
customCredentials,
|
|
27
|
-
region,
|
|
28
|
-
service,
|
|
29
|
-
forcePathStyle,
|
|
30
|
-
requestHandler,
|
|
31
|
-
}: {
|
|
32
|
-
region: AwsRegion;
|
|
33
|
-
customCredentials: CustomCredentials<AwsProvider> | null;
|
|
34
|
-
service: keyof ServiceMapping;
|
|
35
|
-
forcePathStyle: boolean;
|
|
36
|
-
requestHandler: RequestHandler | null;
|
|
37
|
-
}): string => {
|
|
38
|
-
const hashComponents: {[key: string]: unknown} = {};
|
|
39
|
-
|
|
40
|
-
if (getEnvVariable('REMOTION_SKIP_AWS_CREDENTIALS_CHECK')) {
|
|
41
|
-
hashComponents.credentials = {
|
|
42
|
-
credentialsSkipped: true,
|
|
43
|
-
};
|
|
44
|
-
} else if (getEnvVariable('REMOTION_AWS_PROFILE')) {
|
|
45
|
-
hashComponents.credentials = {
|
|
46
|
-
awsProfile: getEnvVariable('REMOTION_AWS_PROFILE'),
|
|
47
|
-
};
|
|
48
|
-
} else if (
|
|
49
|
-
getEnvVariable('REMOTION_AWS_ACCESS_KEY_ID') &&
|
|
50
|
-
getEnvVariable('REMOTION_AWS_SECRET_ACCESS_KEY')
|
|
51
|
-
) {
|
|
52
|
-
hashComponents.credentials = {
|
|
53
|
-
accessKeyId: getEnvVariable('REMOTION_AWS_ACCESS_KEY_ID'),
|
|
54
|
-
secretAccessKey: getEnvVariable('REMOTION_AWS_SECRET_ACCESS_KEY'),
|
|
55
|
-
};
|
|
56
|
-
} else if (getEnvVariable('AWS_PROFILE')) {
|
|
57
|
-
hashComponents.credentials = {
|
|
58
|
-
awsProfile: getEnvVariable('AWS_PROFILE'),
|
|
59
|
-
};
|
|
60
|
-
} else if (
|
|
61
|
-
getEnvVariable('AWS_ACCESS_KEY_ID') &&
|
|
62
|
-
getEnvVariable('AWS_SECRET_ACCESS_KEY')
|
|
63
|
-
) {
|
|
64
|
-
hashComponents.credentials = {
|
|
65
|
-
accessKeyId: getEnvVariable('AWS_ACCESS_KEY_ID') as string,
|
|
66
|
-
secretAccessKey: getEnvVariable('AWS_SECRET_ACCESS_KEY') as string,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
hashComponents.customCredentials = customCredentials;
|
|
71
|
-
hashComponents.region = region;
|
|
72
|
-
hashComponents.service = service;
|
|
73
|
-
hashComponents.forcePathStyle = forcePathStyle;
|
|
74
|
-
hashComponents.requestHandler = requestHandler;
|
|
75
|
-
|
|
76
|
-
return random(JSON.stringify(hashComponents)).toString().replace('0.', '');
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const _clients: Partial<
|
|
80
|
-
Record<
|
|
81
|
-
string,
|
|
82
|
-
| CloudWatchLogsClient
|
|
83
|
-
| LambdaClient
|
|
84
|
-
| S3Client
|
|
85
|
-
| IAMClient
|
|
86
|
-
| ServiceQuotasClient
|
|
87
|
-
| STSClient
|
|
88
|
-
>
|
|
89
|
-
> = {};
|
|
90
|
-
|
|
91
|
-
export const getServiceClient = <T extends keyof ServiceMapping>({
|
|
92
|
-
region,
|
|
93
|
-
service,
|
|
94
|
-
customCredentials,
|
|
95
|
-
forcePathStyle,
|
|
96
|
-
requestHandler,
|
|
97
|
-
}: {
|
|
98
|
-
region: AwsRegion;
|
|
99
|
-
service: T;
|
|
100
|
-
customCredentials: CustomCredentials<AwsProvider> | null;
|
|
101
|
-
forcePathStyle: boolean;
|
|
102
|
-
requestHandler: RequestHandler | null;
|
|
103
|
-
}): ServiceMapping[T] => {
|
|
104
|
-
const Client = (() => {
|
|
105
|
-
if (service === 'cloudwatch') {
|
|
106
|
-
return CloudWatchLogsClient;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (service === 'lambda') {
|
|
110
|
-
return LambdaClient;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (service === 's3') {
|
|
114
|
-
return S3Client;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (service === 'iam') {
|
|
118
|
-
return IAMClient;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (service === 'servicequotas') {
|
|
122
|
-
return ServiceQuotasClient;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (service === 'sts') {
|
|
126
|
-
return STSClient;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
throw new TypeError('unknown client ' + service);
|
|
130
|
-
})();
|
|
131
|
-
|
|
132
|
-
const key = getCredentialsHash({
|
|
133
|
-
region,
|
|
134
|
-
customCredentials,
|
|
135
|
-
service,
|
|
136
|
-
forcePathStyle,
|
|
137
|
-
requestHandler,
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
if (!_clients[key]) {
|
|
141
|
-
checkCredentials();
|
|
142
|
-
|
|
143
|
-
const lambdaOptions =
|
|
144
|
-
service === 'lambda'
|
|
145
|
-
? {
|
|
146
|
-
httpsAgent: {
|
|
147
|
-
maxSockets: MAX_FUNCTIONS_PER_RENDER * 2,
|
|
148
|
-
},
|
|
149
|
-
}
|
|
150
|
-
: undefined;
|
|
151
|
-
|
|
152
|
-
// Merge custom requestHandler with lambda options
|
|
153
|
-
const finalRequestHandler = requestHandler
|
|
154
|
-
? lambdaOptions
|
|
155
|
-
? {...requestHandler, ...lambdaOptions}
|
|
156
|
-
: requestHandler
|
|
157
|
-
: lambdaOptions;
|
|
158
|
-
|
|
159
|
-
const client = customCredentials
|
|
160
|
-
? new Client({
|
|
161
|
-
region: customCredentials.region ?? 'us-east-1',
|
|
162
|
-
credentials:
|
|
163
|
-
customCredentials.accessKeyId && customCredentials.secretAccessKey
|
|
164
|
-
? {
|
|
165
|
-
accessKeyId: customCredentials.accessKeyId,
|
|
166
|
-
secretAccessKey: customCredentials.secretAccessKey,
|
|
167
|
-
}
|
|
168
|
-
: undefined,
|
|
169
|
-
endpoint: customCredentials.endpoint,
|
|
170
|
-
requestHandler: finalRequestHandler,
|
|
171
|
-
forcePathStyle: customCredentials.forcePathStyle,
|
|
172
|
-
maxAttempts: service === 'lambda' ? 1 : undefined,
|
|
173
|
-
})
|
|
174
|
-
: getEnvVariable('REMOTION_SKIP_AWS_CREDENTIALS_CHECK')
|
|
175
|
-
? new Client({
|
|
176
|
-
region,
|
|
177
|
-
requestHandler: finalRequestHandler,
|
|
178
|
-
maxAttempts: service === 'lambda' ? 1 : undefined,
|
|
179
|
-
})
|
|
180
|
-
: new Client({
|
|
181
|
-
region,
|
|
182
|
-
credentials: getCredentials(),
|
|
183
|
-
requestHandler: finalRequestHandler,
|
|
184
|
-
maxAttempts: service === 'lambda' ? 1 : undefined,
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
if (getEnvVariable('REMOTION_DISABLE_AWS_CLIENT_CACHE')) {
|
|
188
|
-
return client as ServiceMapping[T];
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
_clients[key] = client;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return _clients[key] as ServiceMapping[T];
|
|
195
|
-
};
|
package/src/get-sites.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import type {ProviderSpecifics} from '@remotion/serverless-client';
|
|
2
|
-
import type {AwsProvider} from './aws-provider';
|
|
3
|
-
import {awsImplementation} from './aws-provider';
|
|
4
|
-
import {getSitesKey} from './constants';
|
|
5
|
-
import type {BucketWithLocation} from './get-buckets';
|
|
6
|
-
import {makeS3ServeUrl} from './make-s3-url';
|
|
7
|
-
import type {AwsRegion} from './regions';
|
|
8
|
-
import type {RequestHandler} from './types';
|
|
9
|
-
|
|
10
|
-
type Site = {
|
|
11
|
-
sizeInBytes: number;
|
|
12
|
-
lastModified: number | null;
|
|
13
|
-
bucketName: string;
|
|
14
|
-
id: string;
|
|
15
|
-
serveUrl: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
type MandatoryParameters = {
|
|
19
|
-
region: AwsRegion;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
type OptionalParameters = {
|
|
23
|
-
forceBucketName: string | null;
|
|
24
|
-
forcePathStyle: boolean;
|
|
25
|
-
requestHandler: RequestHandler | null;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
type GetSitesInternalInput = MandatoryParameters & OptionalParameters;
|
|
29
|
-
export type GetSitesInput = MandatoryParameters & Partial<OptionalParameters>;
|
|
30
|
-
|
|
31
|
-
export type GetSitesOutput = {
|
|
32
|
-
sites: Site[];
|
|
33
|
-
buckets: BucketWithLocation[];
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const internalGetSites = async ({
|
|
37
|
-
region,
|
|
38
|
-
forceBucketName,
|
|
39
|
-
providerSpecifics,
|
|
40
|
-
forcePathStyle,
|
|
41
|
-
requestHandler,
|
|
42
|
-
}: GetSitesInternalInput & {
|
|
43
|
-
providerSpecifics: ProviderSpecifics<AwsProvider>;
|
|
44
|
-
}): Promise<GetSitesOutput> => {
|
|
45
|
-
const remotionBuckets = forceBucketName
|
|
46
|
-
? await providerSpecifics.getBuckets({
|
|
47
|
-
region,
|
|
48
|
-
forceBucketName,
|
|
49
|
-
forcePathStyle,
|
|
50
|
-
requestHandler,
|
|
51
|
-
})
|
|
52
|
-
: await providerSpecifics.getBuckets({
|
|
53
|
-
region,
|
|
54
|
-
forceBucketName: null,
|
|
55
|
-
forcePathStyle,
|
|
56
|
-
requestHandler,
|
|
57
|
-
});
|
|
58
|
-
const accountId = await providerSpecifics.getAccountId({region});
|
|
59
|
-
|
|
60
|
-
const sites: {[key: string]: Site} = {};
|
|
61
|
-
|
|
62
|
-
for (const bucket of remotionBuckets) {
|
|
63
|
-
const ls = await providerSpecifics.listObjects({
|
|
64
|
-
bucketName: bucket.name,
|
|
65
|
-
prefix: getSitesKey(''),
|
|
66
|
-
region,
|
|
67
|
-
expectedBucketOwner: accountId,
|
|
68
|
-
forcePathStyle,
|
|
69
|
-
requestHandler,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
for (const file of ls) {
|
|
73
|
-
const siteKeyMatch = file.Key?.match(
|
|
74
|
-
/sites\/([0-9a-zA-Z-!_.*'()]+)\/(.*)$/,
|
|
75
|
-
);
|
|
76
|
-
if (!siteKeyMatch) {
|
|
77
|
-
throw new Error(
|
|
78
|
-
`A file was found in the bucket "${bucket.name}" with the key ${file.Key} which is an unexpected folder structure. Delete this file.`,
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const [, siteId] = siteKeyMatch;
|
|
83
|
-
if (!sites[siteId]) {
|
|
84
|
-
sites[siteId] = {
|
|
85
|
-
sizeInBytes: 0,
|
|
86
|
-
bucketName: bucket.name,
|
|
87
|
-
lastModified: null,
|
|
88
|
-
id: siteId,
|
|
89
|
-
serveUrl: makeS3ServeUrl({
|
|
90
|
-
bucketName: bucket.name,
|
|
91
|
-
region,
|
|
92
|
-
subFolder: getSitesKey(siteId),
|
|
93
|
-
}),
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (file.LastModified) {
|
|
98
|
-
const currentLastModified = sites[siteId].lastModified;
|
|
99
|
-
if (
|
|
100
|
-
currentLastModified === null ||
|
|
101
|
-
file.LastModified.getTime() > currentLastModified
|
|
102
|
-
) {
|
|
103
|
-
sites[siteId].lastModified = file.LastModified.getTime();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (file.Size) {
|
|
108
|
-
sites[siteId].sizeInBytes += file.Size;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const sitesArray: Site[] = Object.keys(sites).map((siteId) => {
|
|
114
|
-
return sites[siteId];
|
|
115
|
-
});
|
|
116
|
-
return {sites: sitesArray, buckets: remotionBuckets};
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
/*
|
|
120
|
-
* @description Gets an array of Remotion projects in Cloud Storage, in your GCP project.
|
|
121
|
-
* @see [Documentation](https://remotion.dev/docs/cloudrun/getsites)
|
|
122
|
-
*/
|
|
123
|
-
export const getSites = ({
|
|
124
|
-
region,
|
|
125
|
-
forceBucketName,
|
|
126
|
-
forcePathStyle,
|
|
127
|
-
requestHandler,
|
|
128
|
-
}: GetSitesInput): Promise<GetSitesOutput> => {
|
|
129
|
-
return internalGetSites({
|
|
130
|
-
region,
|
|
131
|
-
forceBucketName: forceBucketName ?? null,
|
|
132
|
-
forcePathStyle: forcePathStyle ?? false,
|
|
133
|
-
providerSpecifics: awsImplementation,
|
|
134
|
-
requestHandler: requestHandler ?? null,
|
|
135
|
-
});
|
|
136
|
-
};
|
package/src/head-file.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {HeadObjectCommand} from '@aws-sdk/client-s3';
|
|
2
|
-
import type {ProviderSpecifics} from '@remotion/serverless-client';
|
|
3
|
-
import type {AwsProvider} from './aws-provider';
|
|
4
|
-
import {getS3Client} from './get-s3-client';
|
|
5
|
-
|
|
6
|
-
export const lambdaHeadFileImplementation: ProviderSpecifics<AwsProvider>['headFile'] =
|
|
7
|
-
async ({
|
|
8
|
-
bucketName,
|
|
9
|
-
key,
|
|
10
|
-
region,
|
|
11
|
-
customCredentials,
|
|
12
|
-
forcePathStyle,
|
|
13
|
-
requestHandler,
|
|
14
|
-
}): Promise<{
|
|
15
|
-
LastModified?: Date | undefined;
|
|
16
|
-
ContentLength?: number | undefined;
|
|
17
|
-
}> => {
|
|
18
|
-
const head = await getS3Client({
|
|
19
|
-
region,
|
|
20
|
-
customCredentials,
|
|
21
|
-
forcePathStyle,
|
|
22
|
-
requestHandler,
|
|
23
|
-
}).send(
|
|
24
|
-
new HeadObjectCommand({
|
|
25
|
-
Bucket: bucketName,
|
|
26
|
-
Key: key,
|
|
27
|
-
}),
|
|
28
|
-
);
|
|
29
|
-
return head;
|
|
30
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
EnhancedErrorInfo,
|
|
3
|
-
GetOrCreateBucketInput,
|
|
4
|
-
GetOrCreateBucketOutput,
|
|
5
|
-
} from '@remotion/serverless-client';
|
|
6
|
-
export type {RuntimePreference} from './runtime-preference';
|
|
7
|
-
import {
|
|
8
|
-
getCloudWatchLogsClient,
|
|
9
|
-
getIamClient,
|
|
10
|
-
getLambdaClient,
|
|
11
|
-
getServiceQuotasClient,
|
|
12
|
-
getStsClient,
|
|
13
|
-
} from './aws-clients';
|
|
14
|
-
import {awsImplementation} from './aws-provider';
|
|
15
|
-
import {parseJsonOrThrowSource} from './call-lambda-streaming';
|
|
16
|
-
import {cleanItems} from './clean-items';
|
|
17
|
-
import {
|
|
18
|
-
DEFAULT_CLOUDWATCH_RETENTION_PERIOD,
|
|
19
|
-
DEFAULT_EPHEMERAL_STORAGE_IN_MB,
|
|
20
|
-
MAX_EPHEMERAL_STORAGE_IN_MB,
|
|
21
|
-
} from './constants';
|
|
22
|
-
import {convertToServeUrlImplementation} from './convert-to-serve-url';
|
|
23
|
-
import {internalDeleteRender} from './delete-render';
|
|
24
|
-
import {
|
|
25
|
-
getCloudwatchMethodUrl,
|
|
26
|
-
getCloudwatchRendererUrl,
|
|
27
|
-
getS3RenderUrl,
|
|
28
|
-
} from './get-aws-urls';
|
|
29
|
-
import {getEnvVariable} from './get-env-variable';
|
|
30
|
-
import {getS3Client} from './get-s3-client';
|
|
31
|
-
import {internalGetSites} from './get-sites';
|
|
32
|
-
import {isFlakyError} from './is-flaky-error';
|
|
33
|
-
import {LAMBDA_VERSION_STRING} from './lambda-version-string';
|
|
34
|
-
import {
|
|
35
|
-
generateRandomHashWithLifeCycleRule,
|
|
36
|
-
getLifeCycleRules,
|
|
37
|
-
} from './lifecycle';
|
|
38
|
-
import {
|
|
39
|
-
getRenderProgressPayload,
|
|
40
|
-
makeLambdaRenderMediaPayload,
|
|
41
|
-
makeLambdaRenderStillPayload,
|
|
42
|
-
} from './make-lambda-payload';
|
|
43
|
-
import {makeS3ServeUrl} from './make-s3-url';
|
|
44
|
-
import {pLimit} from './p-limit';
|
|
45
|
-
import {parseFunctionName} from './parse-function-name';
|
|
46
|
-
import {randomHashImplementation} from './random-hash';
|
|
47
|
-
import {
|
|
48
|
-
internalRenderMediaOnLambdaRaw,
|
|
49
|
-
renderMediaOnLambdaOptionalToRequired,
|
|
50
|
-
} from './render-media-on-lambda';
|
|
51
|
-
import {internalRenderStillOnLambda} from './render-still-on-lambda';
|
|
52
|
-
import {runtimePreferenceOptions} from './runtime-preference';
|
|
53
|
-
import {innerSpeculateFunctionName} from './speculate-function-name';
|
|
54
|
-
import {validateAwsRegion} from './validate-aws-region';
|
|
55
|
-
import {parseBucketName} from './validate-bucketname';
|
|
56
|
-
import {validateDiskSizeInMb} from './validate-disk-size-in-mb';
|
|
57
|
-
import {validateMemorySize} from './validate-memory-size';
|
|
58
|
-
import {validateServeUrl} from './validate-serveurl';
|
|
59
|
-
|
|
60
|
-
export type {
|
|
61
|
-
CustomCredentials,
|
|
62
|
-
DeleteAfter,
|
|
63
|
-
WebhookErrorPayload,
|
|
64
|
-
WebhookPayload,
|
|
65
|
-
WebhookSuccessPayload,
|
|
66
|
-
WebhookTimeoutPayload,
|
|
67
|
-
} from '@remotion/serverless-client';
|
|
68
|
-
export {appRouterWebhook, NextWebhookArgs} from './app-router-webhook';
|
|
69
|
-
export {AwsProvider} from './aws-provider';
|
|
70
|
-
export type {RenderProgress} from './constants';
|
|
71
|
-
export {deleteFunction, DeleteFunctionInput} from './delete-function';
|
|
72
|
-
export {deleteRender, type DeleteRenderInput} from './delete-render';
|
|
73
|
-
export {estimatePrice, EstimatePriceInput} from './estimate-price';
|
|
74
|
-
export {expressWebhook} from './express-webhook';
|
|
75
|
-
export {
|
|
76
|
-
getAwsClient,
|
|
77
|
-
type GetAwsClientInput,
|
|
78
|
-
type GetAwsClientOutput,
|
|
79
|
-
} from './get-aws-client';
|
|
80
|
-
export {
|
|
81
|
-
getCompositionsOnLambda,
|
|
82
|
-
type GetCompositionsOnLambdaInput,
|
|
83
|
-
type GetCompositionsOnLambdaOutput,
|
|
84
|
-
} from './get-compositions-on-lambda';
|
|
85
|
-
export {getFunctionVersion} from './get-function-version';
|
|
86
|
-
export {getFunctions, type GetFunctionsInput} from './get-functions';
|
|
87
|
-
export {getRenderProgress} from './get-render-progress';
|
|
88
|
-
export type {GetRenderProgressInput} from './get-render-progress';
|
|
89
|
-
export {getSites, type GetSitesInput, type GetSitesOutput} from './get-sites';
|
|
90
|
-
export {pagesRouterWebhook} from './pages-router-webhook';
|
|
91
|
-
export {presignUrl, type PresignUrlInput} from './presign-url';
|
|
92
|
-
export type {AwsRegion} from './regions';
|
|
93
|
-
export {
|
|
94
|
-
renderMediaOnLambda,
|
|
95
|
-
renderVideoOnLambda,
|
|
96
|
-
type RenderMediaOnLambdaInput,
|
|
97
|
-
type RenderMediaOnLambdaOutput,
|
|
98
|
-
} from './render-media-on-lambda';
|
|
99
|
-
export {
|
|
100
|
-
renderStillOnLambda,
|
|
101
|
-
type RenderStillOnLambdaInput,
|
|
102
|
-
type RenderStillOnLambdaOutput,
|
|
103
|
-
} from './render-still-on-lambda';
|
|
104
|
-
export {
|
|
105
|
-
speculateFunctionName,
|
|
106
|
-
type SpeculateFunctionNameInput,
|
|
107
|
-
} from './speculate-function-name';
|
|
108
|
-
export type {RequestHandler} from './types';
|
|
109
|
-
export {validateWebhookSignature} from './validate-webhook-signature';
|
|
110
|
-
|
|
111
|
-
export const LambdaClientInternals = {
|
|
112
|
-
generateRandomHashWithLifeCycleRule,
|
|
113
|
-
getLambdaClient,
|
|
114
|
-
getS3Client,
|
|
115
|
-
getS3RenderUrl,
|
|
116
|
-
getIamClient,
|
|
117
|
-
getStsClient,
|
|
118
|
-
getCloudWatchLogsClient,
|
|
119
|
-
getServiceQuotasClient,
|
|
120
|
-
parseJsonOrThrowSource,
|
|
121
|
-
getCloudwatchMethodUrl,
|
|
122
|
-
getCloudwatchRendererUrl,
|
|
123
|
-
MAX_EPHEMERAL_STORAGE_IN_MB,
|
|
124
|
-
parseFunctionName,
|
|
125
|
-
isFlakyError,
|
|
126
|
-
convertToServeUrlImplementation,
|
|
127
|
-
randomHashImplementation,
|
|
128
|
-
parseBucketName,
|
|
129
|
-
makeLambdaRenderMediaPayload,
|
|
130
|
-
renderMediaOnLambdaOptionalToRequired,
|
|
131
|
-
internalDeleteRender,
|
|
132
|
-
internalGetSites,
|
|
133
|
-
getLifeCycleRules,
|
|
134
|
-
awsImplementation,
|
|
135
|
-
runtimePreferenceOptions,
|
|
136
|
-
validateAwsRegion,
|
|
137
|
-
validateDiskSizeInMb,
|
|
138
|
-
validateMemorySize,
|
|
139
|
-
DEFAULT_CLOUDWATCH_RETENTION_PERIOD,
|
|
140
|
-
DEFAULT_EPHEMERAL_STORAGE_IN_MB,
|
|
141
|
-
LAMBDA_VERSION_STRING,
|
|
142
|
-
pLimit,
|
|
143
|
-
makeS3ServeUrl,
|
|
144
|
-
validateServeUrl,
|
|
145
|
-
getEnvVariable,
|
|
146
|
-
internalRenderMediaOnLambdaRaw,
|
|
147
|
-
internalRenderStillOnLambda,
|
|
148
|
-
cleanItems,
|
|
149
|
-
makeLambdaRenderStillPayload,
|
|
150
|
-
getRenderProgressPayload,
|
|
151
|
-
innerSpeculateFunctionName,
|
|
152
|
-
};
|
package/src/is-cli.ts
DELETED
package/src/is-flaky-error.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
export const isFlakyError = (err: Error): boolean => {
|
|
2
|
-
const message = err.stack ?? '';
|
|
3
|
-
|
|
4
|
-
// storage.googleapis.com sometimes returns 500s, and Video does not have retry on its own
|
|
5
|
-
if (
|
|
6
|
-
(message.includes('Format error') || message.includes('audio metadata')) &&
|
|
7
|
-
message.includes('storage.googleapis.com')
|
|
8
|
-
) {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (message.includes('FATAL:zygote_communication_linux.cc')) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (message.includes('error while loading shared libraries: libnss3.so')) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (message.includes('but the server sent no data')) {
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (message.includes('Compositor panicked')) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// S3 in rare occasions
|
|
29
|
-
if (message.includes('We encountered an internal error.')) {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (message.includes('Compositor exited') && !message.includes('SIGSEGV')) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
message.includes('Timed out') &&
|
|
39
|
-
message.includes('while setting up the headless browser')
|
|
40
|
-
) {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// https://github.com/remotion-dev/remotion/issues/2742
|
|
45
|
-
if (message.includes('while trying to connect to the browser')) {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// https://discord.com/channels/809501355504959528/1131234931863998665/1131998442219118622
|
|
50
|
-
if (
|
|
51
|
-
message.includes('RequestTimeout: Your socket connection to the server')
|
|
52
|
-
) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (message.includes('waiting for the page to render the React component')) {
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// In puppeteer-evaluate.ts
|
|
61
|
-
if (message.includes('Timed out evaluating page function')) {
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (message.includes('Timeout exceeded rendering the component')) {
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// CDN slowness
|
|
70
|
-
if (message.includes('Loading root component')) {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Internet flakiness
|
|
75
|
-
if (
|
|
76
|
-
message.includes('getaddrinfo') ||
|
|
77
|
-
message.includes('ECONNRESET') ||
|
|
78
|
-
message.includes('ERR_CONNECTION_TIMED_OUT') ||
|
|
79
|
-
message.includes('ERR_NETWORK_CHANGED') ||
|
|
80
|
-
message.includes('A network error occurred') ||
|
|
81
|
-
message.includes('socket hang up')
|
|
82
|
-
) {
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (message.includes('Target closed') || message.includes('Session closed')) {
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (message.includes('SIGKILL')) {
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// ServiceException: We currently do not have sufficient capacity in the region you requested. Our system will be working on provisioning additional capacity. You can avoid getting this error by temporarily reducing your request rate.
|
|
95
|
-
if (
|
|
96
|
-
message.includes(
|
|
97
|
-
'ServiceException: We currently do not have sufficient capacity in the region you requested',
|
|
98
|
-
)
|
|
99
|
-
) {
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return false;
|
|
104
|
-
};
|
package/src/is-in-lambda.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import {readFileSync} from 'fs';
|
|
2
|
-
import {homedir} from 'os';
|
|
3
|
-
import {join, sep} from 'path';
|
|
4
|
-
import {getEnvVariable} from './get-env-variable';
|
|
5
|
-
|
|
6
|
-
const homeDirCache: Record<string, string> = {};
|
|
7
|
-
|
|
8
|
-
const getHomeDirCacheKey = (): string => {
|
|
9
|
-
// geteuid is only available on POSIX platforms (i.e. not Windows or Android).
|
|
10
|
-
if (process && process.geteuid) {
|
|
11
|
-
return `${process.geteuid()}`;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return 'DEFAULT';
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const getHomeDir = (): string => {
|
|
18
|
-
const {HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep}`} = process.env;
|
|
19
|
-
|
|
20
|
-
if (HOME) return HOME;
|
|
21
|
-
if (USERPROFILE) return USERPROFILE;
|
|
22
|
-
if (HOMEPATH) return `${HOMEDRIVE}${HOMEPATH}`;
|
|
23
|
-
|
|
24
|
-
const homeDirCacheKey = getHomeDirCacheKey();
|
|
25
|
-
if (!homeDirCache[homeDirCacheKey]) homeDirCache[homeDirCacheKey] = homedir();
|
|
26
|
-
|
|
27
|
-
return homeDirCache[homeDirCacheKey];
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const ENV_CREDENTIALS_PATH = 'AWS_SHARED_CREDENTIALS_FILE';
|
|
31
|
-
|
|
32
|
-
// Logic is inline to https://github.com/smithy-lang/smithy-typescript/blob/main/packages/shared-ini-file-loader/src/getCredentialsFilepath.ts#L7
|
|
33
|
-
const pathOfCredentialsFile = () => {
|
|
34
|
-
return (
|
|
35
|
-
getEnvVariable(ENV_CREDENTIALS_PATH) ||
|
|
36
|
-
join(getHomeDir(), '.aws', 'credentials')
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const isLikelyToHaveAwsProfile = (): boolean => {
|
|
41
|
-
// Supabase uses Deno and does not support readFile
|
|
42
|
-
// https://github.com/remotion-dev/remotion/issues/4844
|
|
43
|
-
if (typeof Deno !== 'undefined') {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const credentialsFile = pathOfCredentialsFile();
|
|
48
|
-
|
|
49
|
-
try {
|
|
50
|
-
const content = readFileSync(credentialsFile, 'utf-8');
|
|
51
|
-
return content.includes('[default]');
|
|
52
|
-
} catch {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
};
|