@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.
Files changed (168) hide show
  1. package/dist/cjs/app-router-webhook.d.ts +10 -0
  2. package/dist/cjs/apply-lifecycle.d.ts +8 -0
  3. package/dist/cjs/aws-clients.d.ts +12 -0
  4. package/dist/cjs/aws-provider.d.ts +27 -0
  5. package/dist/cjs/bucket-exists.d.ts +3 -0
  6. package/dist/cjs/call-lambda-async.d.ts +2 -0
  7. package/dist/cjs/call-lambda-streaming.d.ts +6 -0
  8. package/dist/cjs/call-lambda-sync.d.ts +2 -0
  9. package/dist/cjs/check-credentials.d.ts +1 -0
  10. package/dist/cjs/clean-items.d.ts +17 -0
  11. package/dist/cjs/constants.d.ts +25 -0
  12. package/dist/cjs/constants.js +75 -0
  13. package/dist/cjs/content-disposition-header.d.ts +2 -0
  14. package/dist/cjs/convert-to-serve-url.d.ts +6 -0
  15. package/dist/cjs/create-bucket.d.ts +3 -0
  16. package/dist/cjs/delete-file.d.ts +3 -0
  17. package/dist/cjs/delete-function.d.ts +7 -0
  18. package/dist/cjs/delete-render.d.ts +22 -0
  19. package/dist/cjs/encode-aws-url-params.d.ts +1 -0
  20. package/dist/cjs/estimate-price.d.ts +17 -0
  21. package/dist/cjs/express-webhook.d.ts +3 -0
  22. package/dist/cjs/get-account-id.d.ts +3 -0
  23. package/dist/cjs/get-aws-client.d.ts +32 -0
  24. package/dist/cjs/get-aws-urls.d.ts +25 -0
  25. package/dist/cjs/get-buckets.d.ts +9 -0
  26. package/dist/cjs/get-compositions-on-lambda.d.ts +20 -0
  27. package/dist/cjs/get-credentials.d.ts +9 -0
  28. package/dist/cjs/get-env-variable.d.ts +1 -0
  29. package/dist/cjs/get-function-name.d.ts +8 -0
  30. package/dist/cjs/get-function-version.d.ts +9 -0
  31. package/dist/cjs/get-functions.d.ts +10 -0
  32. package/dist/cjs/get-output-url-from-metadata.d.ts +3 -0
  33. package/dist/cjs/get-render-progress.d.ts +17 -0
  34. package/dist/cjs/get-s3-client.d.ts +11 -0
  35. package/dist/cjs/get-service-client.d.ts +25 -0
  36. package/dist/cjs/get-sites.d.ts +31 -0
  37. package/dist/cjs/head-file.d.ts +3 -0
  38. package/dist/cjs/index.d.ts +129 -0
  39. package/dist/cjs/index.js +72692 -0
  40. package/dist/cjs/is-cli.d.ts +2 -0
  41. package/dist/cjs/is-flaky-error.d.ts +1 -0
  42. package/dist/cjs/is-in-lambda.d.ts +1 -0
  43. package/dist/cjs/is-likely-to-have-aws-profile.d.ts +1 -0
  44. package/dist/cjs/lambda-version-string.d.ts +1 -0
  45. package/dist/cjs/lifecycle-rules.d.ts +12 -0
  46. package/dist/cjs/lifecycle.d.ts +7 -0
  47. package/dist/cjs/list-objects.d.ts +3 -0
  48. package/dist/cjs/make-lambda-payload.d.ts +59 -0
  49. package/dist/cjs/make-s3-url.d.ts +6 -0
  50. package/dist/cjs/p-limit.d.ts +1 -0
  51. package/dist/cjs/pages-router-webhook.d.ts +5 -0
  52. package/dist/cjs/parse-function-name.d.ts +8 -0
  53. package/dist/cjs/presign-url.d.ts +17 -0
  54. package/dist/cjs/price-per-1s.d.ts +37 -0
  55. package/dist/cjs/random-hash.d.ts +1 -0
  56. package/dist/cjs/read-file.d.ts +11 -0
  57. package/dist/cjs/regions.d.ts +3 -0
  58. package/dist/cjs/regions.js +80 -0
  59. package/dist/cjs/render-media-on-lambda.d.ts +66 -0
  60. package/dist/cjs/render-still-on-lambda.d.ts +61 -0
  61. package/dist/cjs/runtime-preference.d.ts +2 -0
  62. package/dist/cjs/speculate-function-name.d.ts +7 -0
  63. package/dist/cjs/types.d.ts +4 -0
  64. package/dist/cjs/validate-aws-region.d.ts +2 -0
  65. package/dist/cjs/validate-bucketname.d.ts +4 -0
  66. package/dist/cjs/validate-disk-size-in-mb.d.ts +1 -0
  67. package/dist/cjs/validate-lambda-codec.d.ts +2 -0
  68. package/dist/cjs/validate-memory-size.d.ts +1 -0
  69. package/dist/cjs/validate-presign-expiration.d.ts +1 -0
  70. package/dist/cjs/validate-serveurl.d.ts +1 -0
  71. package/dist/cjs/validate-webhook-signature.d.ts +5 -0
  72. package/dist/cjs/write-file.d.ts +5 -0
  73. package/dist/esm/index.mjs +64284 -13659
  74. package/package.json +15 -16
  75. package/.turbo/turbo-formatting.log +0 -4
  76. package/.turbo/turbo-lint.log +0 -25
  77. package/.turbo/turbo-make.log +0 -3
  78. package/bundle.ts +0 -24
  79. package/dist/test/concurrency-payload.test.d.ts +0 -1
  80. package/dist/test/concurrency-payload.test.js +0 -119
  81. package/dist/test/encode-aws-url.test.d.ts +0 -1
  82. package/dist/test/encode-aws-url.test.js +0 -8
  83. package/dist/test/price-calculation.test.d.ts +0 -1
  84. package/dist/test/price-calculation.test.js +0 -62
  85. package/dist/test/pricing.test.d.ts +0 -1
  86. package/dist/test/pricing.test.js +0 -27
  87. package/dist/test/request-handler.test.d.ts +0 -1
  88. package/dist/test/request-handler.test.js +0 -36
  89. package/dist/test/validate-disk-size-in-mb.test.d.ts +0 -1
  90. package/dist/test/validate-disk-size-in-mb.test.js +0 -14
  91. package/eslint.config.mjs +0 -5
  92. package/src/app-router-webhook.ts +0 -73
  93. package/src/apply-lifecycle.ts +0 -30
  94. package/src/aws-clients.ts +0 -75
  95. package/src/aws-provider.ts +0 -139
  96. package/src/bucket-exists.ts +0 -35
  97. package/src/call-lambda-async.ts +0 -43
  98. package/src/call-lambda-streaming.ts +0 -226
  99. package/src/call-lambda-sync.ts +0 -59
  100. package/src/check-credentials.ts +0 -51
  101. package/src/clean-items.ts +0 -50
  102. package/src/constants.ts +0 -38
  103. package/src/content-disposition-header.ts +0 -64
  104. package/src/convert-to-serve-url.ts +0 -24
  105. package/src/create-bucket.ts +0 -87
  106. package/src/delete-file.ts +0 -38
  107. package/src/delete-function.ts +0 -28
  108. package/src/delete-render.ts +0 -114
  109. package/src/encode-aws-url-params.ts +0 -3
  110. package/src/estimate-price.ts +0 -95
  111. package/src/express-webhook.ts +0 -57
  112. package/src/get-account-id.ts +0 -22
  113. package/src/get-aws-client.ts +0 -63
  114. package/src/get-aws-urls.ts +0 -85
  115. package/src/get-buckets.ts +0 -84
  116. package/src/get-compositions-on-lambda.ts +0 -111
  117. package/src/get-credentials.ts +0 -81
  118. package/src/get-env-variable.ts +0 -15
  119. package/src/get-function-name.ts +0 -24
  120. package/src/get-function-version.ts +0 -49
  121. package/src/get-functions.ts +0 -114
  122. package/src/get-output-url-from-metadata.ts +0 -23
  123. package/src/get-render-progress.ts +0 -66
  124. package/src/get-s3-client.ts +0 -26
  125. package/src/get-service-client.ts +0 -195
  126. package/src/get-sites.ts +0 -136
  127. package/src/head-file.ts +0 -30
  128. package/src/index.ts +0 -152
  129. package/src/is-cli.ts +0 -7
  130. package/src/is-flaky-error.ts +0 -104
  131. package/src/is-in-lambda.ts +0 -5
  132. package/src/is-likely-to-have-aws-profile.ts +0 -55
  133. package/src/lambda-version-string.ts +0 -5
  134. package/src/lifecycle-rules.ts +0 -119
  135. package/src/lifecycle.ts +0 -44
  136. package/src/list-objects.ts +0 -87
  137. package/src/make-lambda-payload.ts +0 -328
  138. package/src/make-s3-url.ts +0 -13
  139. package/src/p-limit.ts +0 -75
  140. package/src/pages-router-webhook.ts +0 -68
  141. package/src/parse-function-name.ts +0 -24
  142. package/src/presign-url.ts +0 -121
  143. package/src/price-per-1s.ts +0 -863
  144. package/src/random-hash.ts +0 -10
  145. package/src/read-file.ts +0 -35
  146. package/src/regions.ts +0 -48
  147. package/src/render-media-on-lambda.ts +0 -227
  148. package/src/render-still-on-lambda.ts +0 -209
  149. package/src/runtime-preference.ts +0 -7
  150. package/src/speculate-function-name.ts +0 -60
  151. package/src/test/concurrency-payload.test.ts +0 -121
  152. package/src/test/encode-aws-url.test.ts +0 -7
  153. package/src/test/price-calculation.test.ts +0 -62
  154. package/src/test/pricing.test.ts +0 -32
  155. package/src/test/request-handler.test.ts +0 -42
  156. package/src/test/validate-disk-size-in-mb.test.ts +0 -15
  157. package/src/types.ts +0 -7
  158. package/src/validate-aws-region.ts +0 -14
  159. package/src/validate-bucketname.ts +0 -24
  160. package/src/validate-disk-size-in-mb.ts +0 -37
  161. package/src/validate-lambda-codec.ts +0 -28
  162. package/src/validate-memory-size.ts +0 -31
  163. package/src/validate-presign-expiration.ts +0 -46
  164. package/src/validate-serveurl.ts +0 -9
  165. package/src/validate-webhook-signature.ts +0 -42
  166. package/src/write-file.ts +0 -108
  167. package/tsconfig.json +0 -9
  168. package/tsconfig.tsbuildinfo +0 -1
@@ -1,10 +0,0 @@
1
- const alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789';
2
-
3
- export const randomHashImplementation = (): string => {
4
- return new Array(10)
5
- .fill(1)
6
- .map(() => {
7
- return alphabet[Math.floor(Math.random() * alphabet.length)];
8
- })
9
- .join('');
10
- };
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,7 +0,0 @@
1
- export const runtimePreferenceOptions = [
2
- 'default',
3
- 'apple-emojis',
4
- 'cjk',
5
- ] as const;
6
-
7
- export type RuntimePreference = (typeof runtimePreferenceOptions)[number];
@@ -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
- };