@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.
- package/dist/cjs/index.js +1 -1
- package/dist/esm/index.mjs +1 -1
- package/package.json +3 -3
- 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 -20
- package/dist/cjs/test/concurrency-payload.test.d.ts +0 -1
- package/dist/cjs/test/encode-aws-url.test.d.ts +0 -1
- package/dist/cjs/test/price-calculation.test.d.ts +0 -1
- package/dist/cjs/test/pricing.test.d.ts +0 -1
- package/dist/cjs/test/request-handler.test.d.ts +0 -1
- package/dist/cjs/test/validate-disk-size-in-mb.test.d.ts +0 -1
- 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/dist/tsconfig.tsbuildinfo +0 -1
- 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 -10
package/src/random-hash.ts
DELETED
package/src/read-file.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {GetObjectCommand} from '@aws-sdk/client-s3';
|
|
2
|
-
import type {Readable} from 'stream';
|
|
3
|
-
import {getS3Client} from './get-s3-client';
|
|
4
|
-
import type {AwsRegion} from './regions';
|
|
5
|
-
import type {RequestHandler} from './types';
|
|
6
|
-
|
|
7
|
-
export const lambdaReadFileImplementation = async ({
|
|
8
|
-
bucketName,
|
|
9
|
-
key,
|
|
10
|
-
region,
|
|
11
|
-
expectedBucketOwner,
|
|
12
|
-
forcePathStyle,
|
|
13
|
-
requestHandler,
|
|
14
|
-
}: {
|
|
15
|
-
bucketName: string;
|
|
16
|
-
key: string;
|
|
17
|
-
region: AwsRegion;
|
|
18
|
-
expectedBucketOwner: string | null;
|
|
19
|
-
forcePathStyle: boolean;
|
|
20
|
-
requestHandler: RequestHandler | null;
|
|
21
|
-
}): Promise<Readable> => {
|
|
22
|
-
const {Body} = await getS3Client({
|
|
23
|
-
region,
|
|
24
|
-
customCredentials: null,
|
|
25
|
-
forcePathStyle,
|
|
26
|
-
requestHandler,
|
|
27
|
-
}).send(
|
|
28
|
-
new GetObjectCommand({
|
|
29
|
-
Bucket: bucketName,
|
|
30
|
-
Key: key,
|
|
31
|
-
ExpectedBucketOwner: expectedBucketOwner ?? undefined,
|
|
32
|
-
}),
|
|
33
|
-
);
|
|
34
|
-
return Body as Readable;
|
|
35
|
-
};
|
package/src/regions.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export const DEFAULT_AWS_REGIONS = [
|
|
2
|
-
'eu-central-1',
|
|
3
|
-
'eu-west-1',
|
|
4
|
-
'eu-west-2',
|
|
5
|
-
'eu-west-3',
|
|
6
|
-
'eu-north-1',
|
|
7
|
-
'us-east-1', // N. Virginia
|
|
8
|
-
'us-east-2', // Ohio;
|
|
9
|
-
'us-west-1',
|
|
10
|
-
'us-west-2', // Oregon
|
|
11
|
-
'ap-south-1',
|
|
12
|
-
'ap-southeast-1',
|
|
13
|
-
'ap-southeast-2',
|
|
14
|
-
'ap-northeast-1',
|
|
15
|
-
'ap-northeast-2',
|
|
16
|
-
'ap-northeast-3',
|
|
17
|
-
'ca-central-1',
|
|
18
|
-
'sa-east-1',
|
|
19
|
-
] as const;
|
|
20
|
-
|
|
21
|
-
export const AWS_REGIONS = [
|
|
22
|
-
'eu-central-1',
|
|
23
|
-
'eu-central-2',
|
|
24
|
-
'eu-west-1',
|
|
25
|
-
'eu-west-2',
|
|
26
|
-
'eu-west-3',
|
|
27
|
-
'eu-south-1',
|
|
28
|
-
'eu-north-1',
|
|
29
|
-
'us-east-1', // N. Virginia
|
|
30
|
-
'us-east-2', // Ohio;
|
|
31
|
-
'us-west-1',
|
|
32
|
-
'us-west-2', // Oregon
|
|
33
|
-
'af-south-1',
|
|
34
|
-
'ap-south-1',
|
|
35
|
-
'ap-east-1',
|
|
36
|
-
'ap-southeast-1',
|
|
37
|
-
'ap-southeast-2',
|
|
38
|
-
'ap-northeast-1',
|
|
39
|
-
'ap-northeast-2',
|
|
40
|
-
'ap-northeast-3',
|
|
41
|
-
'ap-southeast-4',
|
|
42
|
-
'ap-southeast-5',
|
|
43
|
-
'ca-central-1',
|
|
44
|
-
'me-south-1',
|
|
45
|
-
'sa-east-1',
|
|
46
|
-
] as const;
|
|
47
|
-
|
|
48
|
-
export type AwsRegion = (typeof AWS_REGIONS)[number];
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import type {StorageClass} from '@aws-sdk/client-s3';
|
|
2
|
-
import type {
|
|
3
|
-
AudioCodec,
|
|
4
|
-
BrowserSafeApis,
|
|
5
|
-
ChromiumOptions,
|
|
6
|
-
DownloadBehavior,
|
|
7
|
-
FrameRange,
|
|
8
|
-
OutNameInput,
|
|
9
|
-
PixelFormat,
|
|
10
|
-
Privacy,
|
|
11
|
-
ProResProfile,
|
|
12
|
-
ServerlessCodec,
|
|
13
|
-
ToOptions,
|
|
14
|
-
VideoImageFormat,
|
|
15
|
-
WebhookOption,
|
|
16
|
-
} from '@remotion/serverless-client';
|
|
17
|
-
import {
|
|
18
|
-
ServerlessRoutines,
|
|
19
|
-
wrapWithErrorHandling,
|
|
20
|
-
} from '@remotion/serverless-client';
|
|
21
|
-
import {awsImplementation, type AwsProvider} from './aws-provider';
|
|
22
|
-
import {
|
|
23
|
-
getCloudwatchMethodUrl,
|
|
24
|
-
getCloudwatchRendererUrl,
|
|
25
|
-
getLambdaInsightsUrl,
|
|
26
|
-
getProgressJsonUrl,
|
|
27
|
-
getS3RenderUrl,
|
|
28
|
-
} from './get-aws-urls';
|
|
29
|
-
import type {InnerRenderMediaOnLambdaInput} from './make-lambda-payload';
|
|
30
|
-
import {makeLambdaRenderMediaPayload} from './make-lambda-payload';
|
|
31
|
-
import type {AwsRegion} from './regions';
|
|
32
|
-
import type {RequestHandler} from './types';
|
|
33
|
-
|
|
34
|
-
export type RenderMediaOnLambdaInput = {
|
|
35
|
-
region: AwsRegion;
|
|
36
|
-
functionName: string;
|
|
37
|
-
serveUrl: string;
|
|
38
|
-
composition: string;
|
|
39
|
-
inputProps?: Record<string, unknown>;
|
|
40
|
-
codec: ServerlessCodec;
|
|
41
|
-
imageFormat?: VideoImageFormat;
|
|
42
|
-
crf?: number | undefined;
|
|
43
|
-
envVariables?: Record<string, string>;
|
|
44
|
-
pixelFormat?: PixelFormat;
|
|
45
|
-
proResProfile?: ProResProfile;
|
|
46
|
-
privacy?: Privacy;
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated Renamed to `jpegQuality`
|
|
49
|
-
*/
|
|
50
|
-
quality?: never;
|
|
51
|
-
jpegQuality?: number;
|
|
52
|
-
maxRetries?: number;
|
|
53
|
-
framesPerLambda?: number;
|
|
54
|
-
concurrency?: number;
|
|
55
|
-
frameRange?: FrameRange;
|
|
56
|
-
outName?: OutNameInput<AwsProvider>;
|
|
57
|
-
chromiumOptions?: Omit<ChromiumOptions, 'enableMultiProcessOnLinux'>;
|
|
58
|
-
scale?: number;
|
|
59
|
-
everyNthFrame?: number;
|
|
60
|
-
concurrencyPerLambda?: number;
|
|
61
|
-
downloadBehavior?: DownloadBehavior | null;
|
|
62
|
-
overwrite?: boolean;
|
|
63
|
-
webhook?: WebhookOption | null;
|
|
64
|
-
forceWidth?: number | null;
|
|
65
|
-
forceHeight?: number | null;
|
|
66
|
-
rendererFunctionName?: string | null;
|
|
67
|
-
forceBucketName?: string;
|
|
68
|
-
audioCodec?: AudioCodec | null;
|
|
69
|
-
/**
|
|
70
|
-
* @deprecated in favor of `logLevel`: true
|
|
71
|
-
*/
|
|
72
|
-
dumpBrowserLogs?: boolean;
|
|
73
|
-
forcePathStyle?: boolean;
|
|
74
|
-
metadata?: Record<string, string> | null;
|
|
75
|
-
storageClass?: StorageClass | null;
|
|
76
|
-
requestHandler?: RequestHandler;
|
|
77
|
-
} & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>>;
|
|
78
|
-
|
|
79
|
-
export type RenderMediaOnLambdaOutput = {
|
|
80
|
-
renderId: string;
|
|
81
|
-
bucketName: string;
|
|
82
|
-
cloudWatchLogs: string;
|
|
83
|
-
cloudWatchMainLogs: string;
|
|
84
|
-
lambdaInsightsLogs: string;
|
|
85
|
-
folderInS3Console: string;
|
|
86
|
-
progressJsonInConsole: string;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export const internalRenderMediaOnLambdaRaw = async (
|
|
90
|
-
input: InnerRenderMediaOnLambdaInput,
|
|
91
|
-
): Promise<RenderMediaOnLambdaOutput> => {
|
|
92
|
-
const {functionName, region, rendererFunctionName} = input;
|
|
93
|
-
|
|
94
|
-
try {
|
|
95
|
-
const res = await awsImplementation.callFunctionSync({
|
|
96
|
-
functionName,
|
|
97
|
-
type: ServerlessRoutines.start,
|
|
98
|
-
payload: await makeLambdaRenderMediaPayload(input),
|
|
99
|
-
region,
|
|
100
|
-
timeoutInTest: 120000,
|
|
101
|
-
requestHandler: input.requestHandler,
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
return {
|
|
105
|
-
renderId: res.renderId,
|
|
106
|
-
bucketName: res.bucketName,
|
|
107
|
-
cloudWatchLogs: getCloudwatchRendererUrl({
|
|
108
|
-
functionName,
|
|
109
|
-
region,
|
|
110
|
-
renderId: res.renderId,
|
|
111
|
-
rendererFunctionName: rendererFunctionName ?? null,
|
|
112
|
-
chunk: null,
|
|
113
|
-
}),
|
|
114
|
-
cloudWatchMainLogs: getCloudwatchMethodUrl({
|
|
115
|
-
renderId: res.renderId,
|
|
116
|
-
functionName,
|
|
117
|
-
method: ServerlessRoutines.launch,
|
|
118
|
-
region,
|
|
119
|
-
rendererFunctionName: rendererFunctionName ?? null,
|
|
120
|
-
}),
|
|
121
|
-
folderInS3Console: getS3RenderUrl({
|
|
122
|
-
bucketName: res.bucketName,
|
|
123
|
-
renderId: res.renderId,
|
|
124
|
-
region,
|
|
125
|
-
}),
|
|
126
|
-
lambdaInsightsLogs: getLambdaInsightsUrl({
|
|
127
|
-
functionName,
|
|
128
|
-
region,
|
|
129
|
-
}),
|
|
130
|
-
progressJsonInConsole: getProgressJsonUrl({
|
|
131
|
-
bucketName: res.bucketName,
|
|
132
|
-
renderId: res.renderId,
|
|
133
|
-
region,
|
|
134
|
-
}),
|
|
135
|
-
};
|
|
136
|
-
} catch (err) {
|
|
137
|
-
if ((err as Error).stack?.includes('UnrecognizedClientException')) {
|
|
138
|
-
throw new Error(
|
|
139
|
-
'UnrecognizedClientException: The AWS credentials provided were probably mixed up. Learn how to fix this issue here: https://remotion.dev/docs/lambda/troubleshooting/unrecognizedclientexception',
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
throw err;
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
export const renderMediaOnLambdaOptionalToRequired = (
|
|
148
|
-
options: RenderMediaOnLambdaInput,
|
|
149
|
-
): InnerRenderMediaOnLambdaInput => {
|
|
150
|
-
return {
|
|
151
|
-
offthreadVideoThreads: options.offthreadVideoThreads ?? null,
|
|
152
|
-
audioBitrate: options.audioBitrate ?? null,
|
|
153
|
-
audioCodec: options.audioCodec ?? null,
|
|
154
|
-
chromiumOptions: options.chromiumOptions ?? {},
|
|
155
|
-
codec: options.codec,
|
|
156
|
-
colorSpace: options.colorSpace ?? null,
|
|
157
|
-
composition: options.composition,
|
|
158
|
-
concurrencyPerLambda: options.concurrencyPerLambda ?? 1,
|
|
159
|
-
concurrency: options.concurrency ?? null,
|
|
160
|
-
crf: options.crf,
|
|
161
|
-
downloadBehavior: options.downloadBehavior ?? {type: 'play-in-browser'},
|
|
162
|
-
envVariables: options.envVariables ?? {},
|
|
163
|
-
everyNthFrame: options.everyNthFrame ?? 1,
|
|
164
|
-
forceBucketName: options.forceBucketName ?? null,
|
|
165
|
-
forceHeight: options.forceHeight ?? null,
|
|
166
|
-
forceWidth: options.forceWidth ?? null,
|
|
167
|
-
frameRange: options.frameRange ?? null,
|
|
168
|
-
framesPerLambda: options.framesPerLambda ?? null,
|
|
169
|
-
functionName: options.functionName,
|
|
170
|
-
imageFormat: options.imageFormat ?? 'jpeg',
|
|
171
|
-
inputProps: options.inputProps ?? {},
|
|
172
|
-
jpegQuality: options.jpegQuality ?? 80,
|
|
173
|
-
logLevel: options.logLevel ?? 'info',
|
|
174
|
-
maxRetries: options.maxRetries ?? 1,
|
|
175
|
-
muted: options.muted ?? false,
|
|
176
|
-
numberOfGifLoops: options.numberOfGifLoops ?? null,
|
|
177
|
-
offthreadVideoCacheSizeInBytes:
|
|
178
|
-
options.offthreadVideoCacheSizeInBytes ?? null,
|
|
179
|
-
outName: options.outName ?? null,
|
|
180
|
-
overwrite: options.overwrite ?? false,
|
|
181
|
-
pixelFormat: options.pixelFormat ?? undefined,
|
|
182
|
-
privacy: options.privacy ?? 'public',
|
|
183
|
-
proResProfile: options.proResProfile ?? undefined,
|
|
184
|
-
region: options.region,
|
|
185
|
-
rendererFunctionName: options.rendererFunctionName ?? null,
|
|
186
|
-
scale: options.scale ?? 1,
|
|
187
|
-
serveUrl: options.serveUrl,
|
|
188
|
-
timeoutInMilliseconds: options.timeoutInMilliseconds ?? 30000,
|
|
189
|
-
videoBitrate: options.videoBitrate ?? null,
|
|
190
|
-
encodingMaxRate: options.encodingMaxRate ?? null,
|
|
191
|
-
encodingBufferSize: options.encodingBufferSize ?? null,
|
|
192
|
-
webhook: options.webhook ?? null,
|
|
193
|
-
x264Preset: options.x264Preset ?? null,
|
|
194
|
-
deleteAfter: options.deleteAfter ?? null,
|
|
195
|
-
preferLossless: options.preferLossless ?? false,
|
|
196
|
-
forcePathStyle: options.forcePathStyle ?? false,
|
|
197
|
-
indent: false,
|
|
198
|
-
metadata: options.metadata ?? null,
|
|
199
|
-
apiKey: options.apiKey ?? null,
|
|
200
|
-
storageClass: options.storageClass ?? null,
|
|
201
|
-
requestHandler: options.requestHandler ?? null,
|
|
202
|
-
mediaCacheSizeInBytes: options.mediaCacheSizeInBytes ?? null,
|
|
203
|
-
};
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
const wrapped = wrapWithErrorHandling(internalRenderMediaOnLambdaRaw);
|
|
207
|
-
|
|
208
|
-
/*
|
|
209
|
-
* @description Kicks off a render process on Remotion Lambda. The progress can be tracked using getRenderProgress().
|
|
210
|
-
* @see [Documentation](https://remotion.dev/docs/lambda/rendermediaonlambda)
|
|
211
|
-
*/
|
|
212
|
-
export const renderMediaOnLambda = (
|
|
213
|
-
options: RenderMediaOnLambdaInput,
|
|
214
|
-
): Promise<RenderMediaOnLambdaOutput> => {
|
|
215
|
-
if (options.quality) {
|
|
216
|
-
throw new Error(
|
|
217
|
-
'quality has been renamed to jpegQuality. Please rename the option.',
|
|
218
|
-
);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return wrapped(renderMediaOnLambdaOptionalToRequired(options));
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* @deprecated Renamed to renderMediaOnLambda()
|
|
226
|
-
*/
|
|
227
|
-
export const renderVideoOnLambda = renderMediaOnLambda;
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
BrowserSafeApis,
|
|
3
|
-
ChromiumOptions,
|
|
4
|
-
DownloadBehavior,
|
|
5
|
-
StillImageFormat,
|
|
6
|
-
ToOptions,
|
|
7
|
-
} from '@remotion/serverless-client';
|
|
8
|
-
import {ServerlessRoutines} from '@remotion/serverless-client';
|
|
9
|
-
|
|
10
|
-
import type {StorageClass} from '@aws-sdk/client-s3';
|
|
11
|
-
import type {
|
|
12
|
-
CostsInfo,
|
|
13
|
-
OutNameInput,
|
|
14
|
-
Privacy,
|
|
15
|
-
ReceivedArtifact,
|
|
16
|
-
RenderStillFunctionResponsePayload,
|
|
17
|
-
} from '@remotion/serverless-client';
|
|
18
|
-
import {wrapWithErrorHandling} from '@remotion/serverless-client';
|
|
19
|
-
import {awsImplementation, type AwsProvider} from './aws-provider';
|
|
20
|
-
import {DEFAULT_MAX_RETRIES} from './constants';
|
|
21
|
-
import {getCloudwatchMethodUrl, getLambdaInsightsUrl} from './get-aws-urls';
|
|
22
|
-
import {makeLambdaRenderStillPayload} from './make-lambda-payload';
|
|
23
|
-
import type {AwsRegion} from './regions';
|
|
24
|
-
import type {RequestHandler} from './types';
|
|
25
|
-
|
|
26
|
-
type MandatoryParameters = {
|
|
27
|
-
region: AwsRegion;
|
|
28
|
-
functionName: string;
|
|
29
|
-
serveUrl: string;
|
|
30
|
-
composition: string;
|
|
31
|
-
inputProps: Record<string, unknown>;
|
|
32
|
-
imageFormat: StillImageFormat;
|
|
33
|
-
privacy: Privacy;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
type OptionalParameters = {
|
|
37
|
-
maxRetries: number;
|
|
38
|
-
envVariables: Record<string, string>;
|
|
39
|
-
frame: number;
|
|
40
|
-
outName: OutNameInput<AwsProvider> | null;
|
|
41
|
-
chromiumOptions: ChromiumOptions;
|
|
42
|
-
downloadBehavior: DownloadBehavior;
|
|
43
|
-
forceWidth: number | null;
|
|
44
|
-
forceHeight: number | null;
|
|
45
|
-
forceBucketName: string | null;
|
|
46
|
-
onInit: (data: {
|
|
47
|
-
renderId: string;
|
|
48
|
-
cloudWatchLogs: string;
|
|
49
|
-
lambdaInsightsUrl: string;
|
|
50
|
-
}) => void;
|
|
51
|
-
indent: boolean;
|
|
52
|
-
forcePathStyle: boolean;
|
|
53
|
-
storageClass: StorageClass | null;
|
|
54
|
-
requestHandler: RequestHandler | null | undefined;
|
|
55
|
-
} & ToOptions<typeof BrowserSafeApis.optionsMap.renderStillOnLambda>;
|
|
56
|
-
|
|
57
|
-
export type RenderStillOnLambdaNonNullInput = MandatoryParameters &
|
|
58
|
-
OptionalParameters;
|
|
59
|
-
|
|
60
|
-
export type RenderStillOnLambdaInput = MandatoryParameters &
|
|
61
|
-
Partial<OptionalParameters> & {
|
|
62
|
-
requestHandler?: RequestHandler;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export type RenderStillOnLambdaOutput = {
|
|
66
|
-
estimatedPrice: CostsInfo;
|
|
67
|
-
url: string;
|
|
68
|
-
outKey: string;
|
|
69
|
-
sizeInBytes: number;
|
|
70
|
-
bucketName: string;
|
|
71
|
-
renderId: string;
|
|
72
|
-
cloudWatchLogs: string;
|
|
73
|
-
artifacts: ReceivedArtifact<AwsProvider>[];
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const innerRenderStillOnLambda = async (
|
|
77
|
-
input: RenderStillOnLambdaNonNullInput,
|
|
78
|
-
): Promise<RenderStillOnLambdaOutput> => {
|
|
79
|
-
const {functionName, region, onInit} = input;
|
|
80
|
-
try {
|
|
81
|
-
const payload = await makeLambdaRenderStillPayload(input);
|
|
82
|
-
const res = await new Promise<
|
|
83
|
-
RenderStillFunctionResponsePayload<AwsProvider>
|
|
84
|
-
>((resolve, reject) => {
|
|
85
|
-
awsImplementation
|
|
86
|
-
.callFunctionStreaming<ServerlessRoutines.still>({
|
|
87
|
-
functionName,
|
|
88
|
-
type: ServerlessRoutines.still,
|
|
89
|
-
payload,
|
|
90
|
-
region,
|
|
91
|
-
receivedStreamingPayload: ({message}) => {
|
|
92
|
-
if (message.type === 'render-id-determined') {
|
|
93
|
-
onInit?.({
|
|
94
|
-
renderId: message.payload.renderId,
|
|
95
|
-
cloudWatchLogs: getCloudwatchMethodUrl({
|
|
96
|
-
functionName,
|
|
97
|
-
method: ServerlessRoutines.still,
|
|
98
|
-
region,
|
|
99
|
-
rendererFunctionName: null,
|
|
100
|
-
renderId: message.payload.renderId,
|
|
101
|
-
}),
|
|
102
|
-
lambdaInsightsUrl: getLambdaInsightsUrl({
|
|
103
|
-
functionName,
|
|
104
|
-
region,
|
|
105
|
-
}),
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (message.type === 'error-occurred') {
|
|
110
|
-
reject(new Error(message.payload.error));
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (message.type === 'still-rendered') {
|
|
114
|
-
resolve(message.payload);
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
timeoutInTest: 120000,
|
|
118
|
-
retriesRemaining: input.maxRetries,
|
|
119
|
-
requestHandler: input.requestHandler,
|
|
120
|
-
})
|
|
121
|
-
.then(() => {
|
|
122
|
-
reject(new Error('Expected response to be streamed'));
|
|
123
|
-
})
|
|
124
|
-
.catch((err) => {
|
|
125
|
-
reject(err);
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
return {
|
|
130
|
-
estimatedPrice: res.estimatedPrice,
|
|
131
|
-
url: res.output,
|
|
132
|
-
outKey: res.outKey,
|
|
133
|
-
sizeInBytes: res.size,
|
|
134
|
-
bucketName: res.bucketName,
|
|
135
|
-
renderId: res.renderId,
|
|
136
|
-
cloudWatchLogs: getCloudwatchMethodUrl({
|
|
137
|
-
functionName,
|
|
138
|
-
method: ServerlessRoutines.still,
|
|
139
|
-
region,
|
|
140
|
-
renderId: res.renderId,
|
|
141
|
-
rendererFunctionName: null,
|
|
142
|
-
}),
|
|
143
|
-
artifacts: res.receivedArtifacts,
|
|
144
|
-
};
|
|
145
|
-
} catch (err) {
|
|
146
|
-
if ((err as Error).stack?.includes('UnrecognizedClientException')) {
|
|
147
|
-
throw new Error(
|
|
148
|
-
'UnrecognizedClientException: The AWS credentials provided were probably mixed up. Learn how to fix this issue here: https://remotion.dev/docs/lambda/troubleshooting/unrecognizedclientexception',
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
throw err;
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
export const internalRenderStillOnLambda = wrapWithErrorHandling(
|
|
157
|
-
innerRenderStillOnLambda,
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
/*
|
|
161
|
-
* @description Renders a still image inside a lambda function and writes it to the specified output location.
|
|
162
|
-
* @see [Documentation](https://remotion.dev/docs/lambda/renderstillonlambda)
|
|
163
|
-
*/
|
|
164
|
-
export const renderStillOnLambda = (
|
|
165
|
-
input: RenderStillOnLambdaInput & {
|
|
166
|
-
/**
|
|
167
|
-
* @deprecated Renamed to `jpegQuality`
|
|
168
|
-
*/
|
|
169
|
-
quality?: never;
|
|
170
|
-
/**
|
|
171
|
-
* @deprecated Renamed to `logLevel`
|
|
172
|
-
*/
|
|
173
|
-
dumpBrowserLogs?: boolean;
|
|
174
|
-
},
|
|
175
|
-
) => {
|
|
176
|
-
return internalRenderStillOnLambda({
|
|
177
|
-
chromiumOptions: input.chromiumOptions ?? {},
|
|
178
|
-
composition: input.composition,
|
|
179
|
-
deleteAfter: input.deleteAfter ?? null,
|
|
180
|
-
downloadBehavior: input.downloadBehavior ?? {type: 'play-in-browser'},
|
|
181
|
-
envVariables: input.envVariables ?? {},
|
|
182
|
-
forceBucketName: input.forceBucketName ?? null,
|
|
183
|
-
forceHeight: input.forceHeight ?? null,
|
|
184
|
-
forceWidth: input.forceWidth ?? null,
|
|
185
|
-
frame: input.frame ?? 0,
|
|
186
|
-
functionName: input.functionName,
|
|
187
|
-
imageFormat: input.imageFormat,
|
|
188
|
-
indent: false,
|
|
189
|
-
inputProps: input.inputProps,
|
|
190
|
-
maxRetries: input.maxRetries ?? DEFAULT_MAX_RETRIES,
|
|
191
|
-
onInit: input.onInit ?? (() => undefined),
|
|
192
|
-
outName: input.outName ?? null,
|
|
193
|
-
privacy: input.privacy,
|
|
194
|
-
region: input.region,
|
|
195
|
-
serveUrl: input.serveUrl,
|
|
196
|
-
jpegQuality: input.jpegQuality ?? input.quality ?? 80,
|
|
197
|
-
logLevel: input.dumpBrowserLogs ? 'verbose' : (input.logLevel ?? 'info'),
|
|
198
|
-
offthreadVideoCacheSizeInBytes:
|
|
199
|
-
input.offthreadVideoCacheSizeInBytes ?? null,
|
|
200
|
-
scale: input.scale ?? 1,
|
|
201
|
-
timeoutInMilliseconds: input.timeoutInMilliseconds ?? 30000,
|
|
202
|
-
forcePathStyle: input.forcePathStyle ?? false,
|
|
203
|
-
apiKey: input.apiKey ?? null,
|
|
204
|
-
offthreadVideoThreads: input.offthreadVideoThreads ?? null,
|
|
205
|
-
storageClass: input.storageClass ?? null,
|
|
206
|
-
requestHandler: input.requestHandler ?? null,
|
|
207
|
-
mediaCacheSizeInBytes: input.mediaCacheSizeInBytes ?? null,
|
|
208
|
-
});
|
|
209
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import {RENDER_FN_PREFIX} from './constants';
|
|
2
|
-
import {LAMBDA_VERSION_STRING} from './lambda-version-string';
|
|
3
|
-
|
|
4
|
-
export type SpeculateFunctionNameInput = {
|
|
5
|
-
memorySizeInMb: string | number;
|
|
6
|
-
diskSizeInMb: string | number;
|
|
7
|
-
timeoutInSeconds: string | number;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const innerSpeculateFunctionName = ({
|
|
11
|
-
diskSizeInMb,
|
|
12
|
-
memorySizeInMb,
|
|
13
|
-
timeoutInSeconds,
|
|
14
|
-
}: SpeculateFunctionNameInput) => {
|
|
15
|
-
// No validation here, used in find-function-name.ts
|
|
16
|
-
return [
|
|
17
|
-
`${RENDER_FN_PREFIX}${LAMBDA_VERSION_STRING}`,
|
|
18
|
-
`mem${memorySizeInMb}mb`,
|
|
19
|
-
`disk${diskSizeInMb}mb`,
|
|
20
|
-
`${timeoutInSeconds}sec`,
|
|
21
|
-
].join('-');
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/*
|
|
25
|
-
* @description Speculate the name of the Lambda function that will be created by `deployFunction()` or its CLI equivalent, based on the function configuration.
|
|
26
|
-
* @see [Documentation](https://remotion.dev/docs/lambda/speculatefunctionname)
|
|
27
|
-
*/
|
|
28
|
-
export const speculateFunctionName = ({
|
|
29
|
-
memorySizeInMb,
|
|
30
|
-
diskSizeInMb,
|
|
31
|
-
timeoutInSeconds,
|
|
32
|
-
}: SpeculateFunctionNameInput) => {
|
|
33
|
-
const memorySize = Number(memorySizeInMb);
|
|
34
|
-
const diskSize = Number(diskSizeInMb);
|
|
35
|
-
const timeout = Number(timeoutInSeconds);
|
|
36
|
-
|
|
37
|
-
if (!Number.isInteger(memorySize) || memorySize <= 0) {
|
|
38
|
-
throw new Error(
|
|
39
|
-
`Memory size must be a positive integer. Received: ${memorySizeInMb}`,
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (!Number.isInteger(diskSize) || diskSize <= 0) {
|
|
44
|
-
throw new Error(
|
|
45
|
-
`Disk size must be a positive integer. Received: ${diskSizeInMb}`,
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (!Number.isInteger(timeout) || timeout <= 0) {
|
|
50
|
-
throw new Error(
|
|
51
|
-
`Timeout must be a positive integer. Received: ${timeoutInSeconds}`,
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return innerSpeculateFunctionName({
|
|
56
|
-
diskSizeInMb,
|
|
57
|
-
memorySizeInMb,
|
|
58
|
-
timeoutInSeconds,
|
|
59
|
-
});
|
|
60
|
-
};
|