@remotion/lambda 4.0.147 → 4.0.149

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 (34) hide show
  1. package/dist/admin/make-layer-public.js +11 -9
  2. package/dist/api/create-function.d.ts +4 -1
  3. package/dist/api/create-function.js +35 -6
  4. package/dist/api/deploy-function.d.ts +3 -1
  5. package/dist/api/deploy-function.js +8 -3
  6. package/dist/api/deploy-site.d.ts +3 -3
  7. package/dist/api/iam-validation/role-permissions.d.ts +1 -3
  8. package/dist/api/iam-validation/role-permissions.js +12 -13
  9. package/dist/api/iam-validation/user-permissions.d.ts +1 -2
  10. package/dist/api/iam-validation/user-permissions.js +28 -29
  11. package/dist/api/make-lambda-payload.d.ts +1 -1
  12. package/dist/api/make-lambda-payload.js +1 -1
  13. package/dist/api/render-media-on-lambda.js +1 -1
  14. package/dist/cli/commands/functions/deploy.js +6 -2
  15. package/dist/cli/commands/render/progress.js +11 -19
  16. package/dist/cli/commands/sites/create.js +21 -12
  17. package/dist/cli/helpers/progress-bar.js +3 -6
  18. package/dist/functions/helpers/find-output-file-in-bucket.js +2 -1
  19. package/dist/functions/helpers/get-chromium-executable-path.js +1 -2
  20. package/dist/functions/helpers/io.d.ts +2 -1
  21. package/dist/functions/helpers/io.js +2 -2
  22. package/dist/functions/helpers/streaming-payloads.d.ts +3 -3
  23. package/dist/functions/launch.js +3 -0
  24. package/dist/functions/renderer.js +0 -1
  25. package/dist/internals.d.ts +5 -5
  26. package/dist/shared/constants.d.ts +3 -3
  27. package/dist/shared/hosted-layers.d.ts +1 -0
  28. package/dist/shared/hosted-layers.js +213 -1
  29. package/dist/shared/invoke-webhook.d.ts +1 -0
  30. package/dist/shared/invoke-webhook.js +23 -1
  31. package/package.json +10 -12
  32. package/remotionlambda-arm64.zip +0 -0
  33. package/dist/functions/helpers/nss.d.ts +0 -2
  34. package/dist/functions/helpers/nss.js +0 -39
@@ -60,12 +60,12 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel) => {
60
60
  stats: null,
61
61
  },
62
62
  };
63
- const updateProgress = () => {
63
+ const updateProgress = (newLine) => {
64
64
  progressBar.update([
65
65
  (0, progress_bar_1.makeBundleProgress)(multiProgress.bundleProgress),
66
66
  (0, progress_bar_1.makeBucketProgress)(multiProgress.bucketProgress),
67
67
  (0, progress_bar_1.makeDeployProgressBar)(multiProgress.deployProgress),
68
- ].join('\n'), false);
68
+ ].join('\n'), newLine);
69
69
  };
70
70
  const bucketStart = Date.now();
71
71
  const enableFolderExpiry = folderExpiryOption.getValue({
@@ -78,7 +78,7 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel) => {
78
78
  customCredentials: null,
79
79
  })).bucketName;
80
80
  multiProgress.bucketProgress.doneIn = Date.now() - bucketStart;
81
- updateProgress();
81
+ updateProgress(false);
82
82
  const bundleStart = Date.now();
83
83
  let uploadStart = Date.now();
84
84
  const publicDir = publicDirOption.getValue({
@@ -102,7 +102,7 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel) => {
102
102
  if (progress === 100) {
103
103
  uploadStart = Date.now();
104
104
  }
105
- updateProgress();
105
+ updateProgress(false);
106
106
  },
107
107
  onUploadProgress: (p) => {
108
108
  multiProgress.deployProgress = {
@@ -111,7 +111,7 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel) => {
111
111
  doneIn: null,
112
112
  stats: null,
113
113
  };
114
- updateProgress();
114
+ updateProgress(false);
115
115
  },
116
116
  enableCaching: config_1.ConfigInternals.getWebpackCaching(),
117
117
  webpackOverride: (_c = config_1.ConfigInternals.getWebpackOverrideFn()) !== null && _c !== void 0 ? _c : ((f) => f),
@@ -135,14 +135,23 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel) => {
135
135
  untouchedFiles: stats.untouchedFiles,
136
136
  },
137
137
  };
138
- updateProgress();
139
- log_1.Log.info({ indent: false, logLevel });
140
- log_1.Log.info({ indent: false, logLevel });
141
- log_1.Log.info({ indent: false, logLevel }, 'Deployed to S3!');
142
- log_1.Log.info({ indent: false, logLevel }, `Serve URL: ${serveUrl}`);
143
- log_1.Log.info({ indent: false, logLevel }, `Site Name: ${siteName}`);
138
+ updateProgress(true);
139
+ cli_1.CliInternals.printFact('info')({
140
+ indent: false,
141
+ left: 'Serve URL',
142
+ logLevel,
143
+ right: serveUrl,
144
+ color: 'blue',
145
+ });
146
+ cli_1.CliInternals.printFact('info')({
147
+ indent: false,
148
+ left: 'Site name',
149
+ logLevel,
150
+ right: siteName,
151
+ color: 'blue',
152
+ });
144
153
  log_1.Log.info({ indent: false, logLevel });
145
- log_1.Log.info({ indent: false, logLevel }, cli_1.CliInternals.chalk.blueBright('ℹ️ If you make changes to your code, you need to redeploy the site. You can overwrite the existing site by running:'));
154
+ log_1.Log.info({ indent: false, logLevel }, cli_1.CliInternals.chalk.blueBright('ℹ️ Redeploy your site everytime you make changes to it. You can overwrite the existing site by running:'));
146
155
  log_1.Log.info({ indent: false, logLevel }, cli_1.CliInternals.chalk.blueBright(['npx remotion lambda sites create', args[0], `--site-name=${siteName}`]
147
156
  .filter(no_react_1.NoReactInternals.truthy)
148
157
  .join(' ')));
@@ -5,9 +5,8 @@ const cli_1 = require("@remotion/cli");
5
5
  const no_react_1 = require("remotion/no-react");
6
6
  const makeBundleProgress = ({ progress, doneIn }) => {
7
7
  return [
8
- `(1/3)`,
8
+ `${doneIn === null ? 'Bundling' : 'Bundled'} video`.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' '),
9
9
  cli_1.CliInternals.makeProgressBar(progress / 100),
10
- `${doneIn === null ? 'Bundling' : 'Bundled'} video`,
11
10
  doneIn === null
12
11
  ? `${Math.round(progress)}%`
13
12
  : cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
@@ -17,9 +16,8 @@ exports.makeBundleProgress = makeBundleProgress;
17
16
  const makeBucketProgress = ({ doneIn }) => {
18
17
  const progress = doneIn === null ? 0 : 1;
19
18
  return [
20
- `(2/3)`,
19
+ `${doneIn === null ? 'Creating' : 'Created'} bucket`.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' '),
21
20
  cli_1.CliInternals.makeProgressBar(progress),
22
- `${doneIn === null ? 'Creating' : 'Created'} bucket`,
23
21
  doneIn === null ? `0/1` : cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
24
22
  ].join(' ');
25
23
  };
@@ -42,9 +40,8 @@ const makeUploadDiff = ({ stats }) => {
42
40
  const makeDeployProgressBar = ({ sizeUploaded, totalSize, doneIn, stats, }) => {
43
41
  const progress = totalSize === null ? 0 : sizeUploaded / totalSize;
44
42
  return [
45
- `(3/3)`,
43
+ `${doneIn === null ? 'Uploading' : 'Uploaded'} to S3`.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' '),
46
44
  cli_1.CliInternals.makeProgressBar(progress),
47
- `${doneIn === null ? 'Uploading' : 'Uploaded'} to S3`,
48
45
  doneIn === null
49
46
  ? typeof totalSize === 'number'
50
47
  ? `${cli_1.CliInternals.formatBytes(sizeUploaded)}/${cli_1.CliInternals.formatBytes(totalSize)}`
@@ -10,12 +10,13 @@ const findOutputFileInBucket = async ({ region, renderMetadata, bucketName, cust
10
10
  if (!renderMetadata) {
11
11
  throw new Error('unexpectedly did not get renderMetadata');
12
12
  }
13
- const { renderBucketName, key } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, bucketName, null);
13
+ const { renderBucketName, key } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, bucketName, customCredentials);
14
14
  try {
15
15
  const head = await (0, io_1.lambdaHeadCommand)({
16
16
  bucketName,
17
17
  key,
18
18
  region,
19
+ customCredentials,
19
20
  });
20
21
  return {
21
22
  lastModified: (_a = head.LastModified) === null || _a === void 0 ? void 0 : _a.getTime(),
@@ -2,8 +2,7 @@
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.executablePath = void 0;
5
- if (/^AWS_Lambda_nodejs(?:18)[.]x$/.test((_a = process.env.AWS_EXECUTION_ENV) !== null && _a !== void 0 ? _a : '') ===
6
- true) {
5
+ if (/^AWS_Lambda_nodejs(?:18|20)[.]x$/.test((_a = process.env.AWS_EXECUTION_ENV) !== null && _a !== void 0 ? _a : '') === true) {
7
6
  process.env.FONTCONFIG_PATH = '/opt';
8
7
  process.env.FONTCONFIG_FILE = '/opt/fonts.conf';
9
8
  process.env.DISABLE_FROM_SURFACE = '1';
@@ -42,10 +42,11 @@ export declare const lambdaReadFile: ({ bucketName, key, region, expectedBucketO
42
42
  region: AwsRegion;
43
43
  expectedBucketOwner: string;
44
44
  }) => Promise<Readable>;
45
- export declare const lambdaHeadCommand: ({ bucketName, key, region, }: {
45
+ export declare const lambdaHeadCommand: ({ bucketName, key, region, customCredentials, }: {
46
46
  bucketName: string;
47
47
  key: string;
48
48
  region: AwsRegion;
49
+ customCredentials: CustomCredentials | null;
49
50
  }) => Promise<{
50
51
  LastModified?: Date | undefined;
51
52
  ContentLength?: number | undefined;
@@ -105,8 +105,8 @@ const lambdaReadFile = async ({ bucketName, key, region, expectedBucketOwner, })
105
105
  return Body;
106
106
  };
107
107
  exports.lambdaReadFile = lambdaReadFile;
108
- const lambdaHeadCommand = async ({ bucketName, key, region, }) => {
109
- const head = await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.HeadObjectCommand({
108
+ const lambdaHeadCommand = async ({ bucketName, key, region, customCredentials, }) => {
109
+ const head = await (0, aws_clients_1.getS3Client)(region, customCredentials).send(new client_s3_1.HeadObjectCommand({
110
110
  Bucket: bucketName,
111
111
  Key: key,
112
112
  }));
@@ -4,16 +4,16 @@ declare const streamingPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
4
4
  type: z.ZodLiteral<"render-id-determined">;
5
5
  renderId: z.ZodString;
6
6
  }, "strip", z.ZodTypeAny, {
7
- type: "render-id-determined";
8
7
  renderId: string;
9
- }, {
10
8
  type: "render-id-determined";
9
+ }, {
11
10
  renderId: string;
11
+ type: "render-id-determined";
12
12
  }>]>;
13
13
  export type StreamingPayloads = z.infer<typeof streamingPayloadSchema>;
14
14
  export declare const isStreamingPayload: (str: string) => false | {
15
- type: "render-id-determined";
16
15
  renderId: string;
16
+ type: "render-id-determined";
17
17
  };
18
18
  export declare const sendProgressEvent: (responseStream: ResponseStream, payload: StreamingPayloads) => void;
19
19
  export {};
@@ -384,6 +384,7 @@ const launchHandler = async (params, options) => {
384
384
  bucketName: params.bucketName,
385
385
  customData: (_a = params.webhook.customData) !== null && _a !== void 0 ? _a : null,
386
386
  },
387
+ redirectsSoFar: 0,
387
388
  }, params.logLevel);
388
389
  webhookInvoked = true;
389
390
  }
@@ -452,6 +453,7 @@ const launchHandler = async (params, options) => {
452
453
  timeToFinish: postRenderData.timeToFinish,
453
454
  costs: postRenderData.cost,
454
455
  },
456
+ redirectsSoFar: 0,
455
457
  }, params.logLevel);
456
458
  webhookInvoked = true;
457
459
  }
@@ -526,6 +528,7 @@ const launchHandler = async (params, options) => {
526
528
  stack: e.stack,
527
529
  })),
528
530
  },
531
+ redirectsSoFar: 0,
529
532
  }, params.logLevel);
530
533
  webhookInvoked = true;
531
534
  }
@@ -190,7 +190,6 @@ const renderHandler = async (params, options, logs) => {
190
190
  serializedResolvedPropsWithCustomSchema: resolvedProps,
191
191
  offthreadVideoCacheSizeInBytes: params.offthreadVideoCacheSizeInBytes,
192
192
  colorSpace: params.colorSpace,
193
- finishRenderProgress: () => undefined,
194
193
  binariesDirectory: null,
195
194
  separateAudioTo: audioOutputLocation,
196
195
  forSeamlessAacConcatenation: seamlessAudio,
@@ -1,5 +1,5 @@
1
1
  export declare const LambdaInternals: {
2
- executeCommand: (args: string[], remotionRoot: string, logLevel: "error" | "verbose" | "info" | "warn") => Promise<void>;
2
+ executeCommand: (args: string[], remotionRoot: string, logLevel: "verbose" | "info" | "warn" | "error") => Promise<void>;
3
3
  makeLambdaRenderMediaPayload: ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, x264Preset, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, encodingMaxRate, encodingBufferSize, downloadBehavior, muted, overwrite, jpegQuality, offthreadVideoCacheSizeInBytes, deleteAfter, colorSpace, preferLossless, }: import("./api/make-lambda-payload").InnerRenderMediaOnLambdaInput) => Promise<import("./defaults").LambdaStartPayload>;
4
4
  getRenderProgressPayload: ({ bucketName, renderId, s3OutputProvider, logLevel, }: import(".").GetRenderProgressInput) => import("./defaults").LambdaStatusPayload;
5
5
  makeLambdaRenderStillPayload: ({ serveUrl, inputProps, imageFormat, envVariables, quality, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, offthreadVideoCacheSizeInBytes, deleteAfter, }: import("./api/render-still-on-lambda").RenderStillOnLambdaNonNullInput) => Promise<{
@@ -14,7 +14,7 @@ export declare const LambdaInternals: {
14
14
  maxRetries: number;
15
15
  frame: number;
16
16
  privacy: import("./defaults").Privacy;
17
- logLevel: "error" | "verbose" | "info" | "warn";
17
+ logLevel: "verbose" | "info" | "warn" | "error";
18
18
  outName: import("./defaults").OutNameInput | null;
19
19
  timeoutInMilliseconds: number;
20
20
  chromiumOptions: import("@remotion/renderer").ChromiumOptions;
@@ -56,11 +56,11 @@ export declare const LambdaInternals: {
56
56
  getValue: ({ commandLine }: {
57
57
  commandLine: Record<string, unknown>;
58
58
  }) => {
59
- value: "error" | "verbose" | "info" | "warn";
59
+ value: "verbose" | "info" | "warn" | "error";
60
60
  source: string;
61
61
  };
62
- setConfig: (newLogLevel: "error" | "verbose" | "info" | "warn") => void;
63
- type: "error" | "verbose" | "info" | "warn";
62
+ setConfig: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
63
+ type: "verbose" | "info" | "warn" | "error";
64
64
  };
65
65
  readonly throwIfSiteExists: {
66
66
  cliFlag: string;
@@ -157,7 +157,7 @@ export type LambdaStartPayload = {
157
157
  bucketName: string | null;
158
158
  offthreadVideoCacheSizeInBytes: number | null;
159
159
  deleteAfter: DeleteAfter | null;
160
- colorSpace: ColorSpace;
160
+ colorSpace: ColorSpace | null;
161
161
  preferLossless: boolean;
162
162
  };
163
163
  export type LambdaStatusPayload = {
@@ -215,7 +215,7 @@ export type LambdaPayloads = {
215
215
  forceWidth: number | null;
216
216
  offthreadVideoCacheSizeInBytes: number | null;
217
217
  deleteAfter: DeleteAfter | null;
218
- colorSpace: ColorSpace;
218
+ colorSpace: ColorSpace | null;
219
219
  preferLossless: boolean;
220
220
  };
221
221
  status: LambdaStatusPayload;
@@ -261,7 +261,7 @@ export type LambdaPayloads = {
261
261
  preferLossless: boolean;
262
262
  offthreadVideoCacheSizeInBytes: number | null;
263
263
  deleteAfter: DeleteAfter | null;
264
- colorSpace: ColorSpace;
264
+ colorSpace: ColorSpace | null;
265
265
  compositionStart: number;
266
266
  framesPerLambda: number;
267
267
  };
@@ -7,3 +7,4 @@ export type HostedLayers = {
7
7
  }[];
8
8
  };
9
9
  export declare const hostedLayers: HostedLayers;
10
+ export declare const v5HostedLayers: HostedLayers;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hostedLayers = exports.REMOTION_HOSTED_LAYER_ARN = void 0;
3
+ exports.v5HostedLayers = exports.hostedLayers = exports.REMOTION_HOSTED_LAYER_ARN = void 0;
4
4
  exports.REMOTION_HOSTED_LAYER_ARN = `arn:aws:lambda:*:678892195805:layer:remotion-binaries-*`;
5
5
  exports.hostedLayers = {
6
6
  'ap-northeast-1': [
@@ -214,3 +214,215 @@ exports.hostedLayers = {
214
214
  },
215
215
  ],
216
216
  };
217
+ exports.v5HostedLayers = {
218
+ 'ap-northeast-1': [
219
+ {
220
+ layerArn: 'arn:aws:lambda:ap-northeast-1:678892195805:layer:remotion-binaries-fonts-arm64',
221
+ version: 11,
222
+ },
223
+ {
224
+ layerArn: 'arn:aws:lambda:ap-northeast-1:678892195805:layer:remotion-binaries-chromium-arm64',
225
+ version: 15,
226
+ },
227
+ ],
228
+ 'ap-south-1': [
229
+ {
230
+ layerArn: 'arn:aws:lambda:ap-south-1:678892195805:layer:remotion-binaries-fonts-arm64',
231
+ version: 11,
232
+ },
233
+ {
234
+ layerArn: 'arn:aws:lambda:ap-south-1:678892195805:layer:remotion-binaries-chromium-arm64',
235
+ version: 15,
236
+ },
237
+ ],
238
+ 'ap-southeast-1': [
239
+ {
240
+ layerArn: 'arn:aws:lambda:ap-southeast-1:678892195805:layer:remotion-binaries-fonts-arm64',
241
+ version: 11,
242
+ },
243
+ {
244
+ layerArn: 'arn:aws:lambda:ap-southeast-1:678892195805:layer:remotion-binaries-chromium-arm64',
245
+ version: 15,
246
+ },
247
+ ],
248
+ 'ap-southeast-2': [
249
+ {
250
+ layerArn: 'arn:aws:lambda:ap-southeast-2:678892195805:layer:remotion-binaries-fonts-arm64',
251
+ version: 11,
252
+ },
253
+ {
254
+ layerArn: 'arn:aws:lambda:ap-southeast-2:678892195805:layer:remotion-binaries-chromium-arm64',
255
+ version: 15,
256
+ },
257
+ ],
258
+ 'eu-central-1': [
259
+ {
260
+ layerArn: 'arn:aws:lambda:eu-central-1:678892195805:layer:remotion-binaries-fonts-arm64',
261
+ version: 34,
262
+ },
263
+ {
264
+ layerArn: 'arn:aws:lambda:eu-central-1:678892195805:layer:remotion-binaries-chromium-arm64',
265
+ version: 35,
266
+ },
267
+ ],
268
+ 'eu-west-1': [
269
+ {
270
+ layerArn: 'arn:aws:lambda:eu-west-1:678892195805:layer:remotion-binaries-fonts-arm64',
271
+ version: 12,
272
+ },
273
+ {
274
+ layerArn: 'arn:aws:lambda:eu-west-1:678892195805:layer:remotion-binaries-chromium-arm64',
275
+ version: 15,
276
+ },
277
+ ],
278
+ 'eu-west-2': [
279
+ {
280
+ layerArn: 'arn:aws:lambda:eu-west-2:678892195805:layer:remotion-binaries-fonts-arm64',
281
+ version: 11,
282
+ },
283
+ {
284
+ layerArn: 'arn:aws:lambda:eu-west-2:678892195805:layer:remotion-binaries-chromium-arm64',
285
+ version: 15,
286
+ },
287
+ ],
288
+ 'us-east-1': [
289
+ {
290
+ layerArn: 'arn:aws:lambda:us-east-1:678892195805:layer:remotion-binaries-fonts-arm64',
291
+ version: 16,
292
+ },
293
+ {
294
+ layerArn: 'arn:aws:lambda:us-east-1:678892195805:layer:remotion-binaries-chromium-arm64',
295
+ version: 24,
296
+ },
297
+ ],
298
+ 'us-east-2': [
299
+ {
300
+ layerArn: 'arn:aws:lambda:us-east-2:678892195805:layer:remotion-binaries-fonts-arm64',
301
+ version: 11,
302
+ },
303
+ {
304
+ layerArn: 'arn:aws:lambda:us-east-2:678892195805:layer:remotion-binaries-chromium-arm64',
305
+ version: 15,
306
+ },
307
+ ],
308
+ 'us-west-2': [
309
+ {
310
+ layerArn: 'arn:aws:lambda:us-west-2:678892195805:layer:remotion-binaries-fonts-arm64',
311
+ version: 11,
312
+ },
313
+ {
314
+ layerArn: 'arn:aws:lambda:us-west-2:678892195805:layer:remotion-binaries-chromium-arm64',
315
+ version: 15,
316
+ },
317
+ ],
318
+ 'af-south-1': [
319
+ {
320
+ layerArn: 'arn:aws:lambda:af-south-1:678892195805:layer:remotion-binaries-fonts-arm64',
321
+ version: 8,
322
+ },
323
+ {
324
+ layerArn: 'arn:aws:lambda:af-south-1:678892195805:layer:remotion-binaries-chromium-arm64',
325
+ version: 8,
326
+ },
327
+ ],
328
+ 'ap-east-1': [
329
+ {
330
+ layerArn: 'arn:aws:lambda:ap-east-1:678892195805:layer:remotion-binaries-fonts-arm64',
331
+ version: 8,
332
+ },
333
+ {
334
+ layerArn: 'arn:aws:lambda:ap-east-1:678892195805:layer:remotion-binaries-chromium-arm64',
335
+ version: 8,
336
+ },
337
+ ],
338
+ 'ap-northeast-2': [
339
+ {
340
+ layerArn: 'arn:aws:lambda:ap-northeast-2:678892195805:layer:remotion-binaries-fonts-arm64',
341
+ version: 8,
342
+ },
343
+ {
344
+ layerArn: 'arn:aws:lambda:ap-northeast-2:678892195805:layer:remotion-binaries-chromium-arm64',
345
+ version: 8,
346
+ },
347
+ ],
348
+ 'ap-northeast-3': [
349
+ {
350
+ layerArn: 'arn:aws:lambda:ap-northeast-3:678892195805:layer:remotion-binaries-fonts-arm64',
351
+ version: 8,
352
+ },
353
+ {
354
+ layerArn: 'arn:aws:lambda:ap-northeast-3:678892195805:layer:remotion-binaries-chromium-arm64',
355
+ version: 8,
356
+ },
357
+ ],
358
+ 'ca-central-1': [
359
+ {
360
+ layerArn: 'arn:aws:lambda:ca-central-1:678892195805:layer:remotion-binaries-fonts-arm64',
361
+ version: 8,
362
+ },
363
+ {
364
+ layerArn: 'arn:aws:lambda:ca-central-1:678892195805:layer:remotion-binaries-chromium-arm64',
365
+ version: 8,
366
+ },
367
+ ],
368
+ 'eu-north-1': [
369
+ {
370
+ layerArn: 'arn:aws:lambda:eu-north-1:678892195805:layer:remotion-binaries-fonts-arm64',
371
+ version: 8,
372
+ },
373
+ {
374
+ layerArn: 'arn:aws:lambda:eu-north-1:678892195805:layer:remotion-binaries-chromium-arm64',
375
+ version: 8,
376
+ },
377
+ ],
378
+ 'eu-south-1': [
379
+ {
380
+ layerArn: 'arn:aws:lambda:eu-south-1:678892195805:layer:remotion-binaries-fonts-arm64',
381
+ version: 8,
382
+ },
383
+ {
384
+ layerArn: 'arn:aws:lambda:eu-south-1:678892195805:layer:remotion-binaries-chromium-arm64',
385
+ version: 8,
386
+ },
387
+ ],
388
+ 'eu-west-3': [
389
+ {
390
+ layerArn: 'arn:aws:lambda:eu-west-3:678892195805:layer:remotion-binaries-fonts-arm64',
391
+ version: 8,
392
+ },
393
+ {
394
+ layerArn: 'arn:aws:lambda:eu-west-3:678892195805:layer:remotion-binaries-chromium-arm64',
395
+ version: 8,
396
+ },
397
+ ],
398
+ 'me-south-1': [
399
+ {
400
+ layerArn: 'arn:aws:lambda:me-south-1:678892195805:layer:remotion-binaries-fonts-arm64',
401
+ version: 8,
402
+ },
403
+ {
404
+ layerArn: 'arn:aws:lambda:me-south-1:678892195805:layer:remotion-binaries-chromium-arm64',
405
+ version: 8,
406
+ },
407
+ ],
408
+ 'sa-east-1': [
409
+ {
410
+ layerArn: 'arn:aws:lambda:sa-east-1:678892195805:layer:remotion-binaries-fonts-arm64',
411
+ version: 8,
412
+ },
413
+ {
414
+ layerArn: 'arn:aws:lambda:sa-east-1:678892195805:layer:remotion-binaries-chromium-arm64',
415
+ version: 8,
416
+ },
417
+ ],
418
+ 'us-west-1': [
419
+ {
420
+ layerArn: 'arn:aws:lambda:us-west-1:678892195805:layer:remotion-binaries-fonts-arm64',
421
+ version: 8,
422
+ },
423
+ {
424
+ layerArn: 'arn:aws:lambda:us-west-1:678892195805:layer:remotion-binaries-chromium-arm64',
425
+ version: 8,
426
+ },
427
+ ],
428
+ };
@@ -44,6 +44,7 @@ type InvokeWebhookOptions = {
44
44
  payload: WebhookPayload;
45
45
  url: string;
46
46
  secret: string | null;
47
+ redirectsSoFar: number;
47
48
  };
48
49
  export declare const invokeWebhook: (options: InvokeWebhookOptions, logLevel: LogLevel, retries?: number, errors?: number) => Promise<void>;
49
50
  export {};
@@ -51,6 +51,9 @@ exports.mockableHttpClients = {
51
51
  http: node_http_1.default.request,
52
52
  https: https_1.default.request,
53
53
  };
54
+ // Don't handle 304 status code (Not Modified) as a redirect,
55
+ // since the browser will display the right page.
56
+ const redirectStatusCodes = [301, 302, 303, 307, 308];
54
57
  const getWebhookClient = (url) => {
55
58
  if (url.startsWith('https://')) {
56
59
  return exports.mockableHttpClients.https;
@@ -60,7 +63,7 @@ const getWebhookClient = (url) => {
60
63
  }
61
64
  throw new Error('Can only request URLs starting with http:// or https://');
62
65
  };
63
- function invokeWebhookRaw({ payload, secret, url, }) {
66
+ function invokeWebhookRaw({ payload, secret, url, redirectsSoFar, }) {
64
67
  const jsonPayload = JSON.stringify(payload);
65
68
  return new Promise((resolve, reject) => {
66
69
  const req = getWebhookClient(url)(url, {
@@ -75,6 +78,25 @@ function invokeWebhookRaw({ payload, secret, url, }) {
75
78
  timeout: 5000,
76
79
  }, (res) => {
77
80
  if (res.statusCode && res.statusCode > 299) {
81
+ if (redirectStatusCodes.includes(res.statusCode)) {
82
+ if (!res.headers.location) {
83
+ reject(new Error(`Received a status code ${res.statusCode} but no "Location" header while calling ${res.headers.location}`));
84
+ return;
85
+ }
86
+ if (redirectsSoFar > 10) {
87
+ reject(new Error(`Too many redirects while downloading ${url}`));
88
+ return;
89
+ }
90
+ invokeWebhookRaw({
91
+ payload,
92
+ secret,
93
+ url: res.headers.location,
94
+ redirectsSoFar: redirectsSoFar + 1,
95
+ })
96
+ .then(resolve)
97
+ .catch(reject);
98
+ return;
99
+ }
78
100
  reject(new Error(`Sent a webhook to ${url} but got a status code of ${res.statusCode} with message '${res.statusMessage}'`));
79
101
  return;
80
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "4.0.147",
3
+ "version": "4.0.149",
4
4
  "description": "Distributed renderer for Remotion based on AWS Lambda",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -23,20 +23,19 @@
23
23
  "@aws-sdk/credential-providers": "3.382.0",
24
24
  "@aws-sdk/lib-storage": "3.382.0",
25
25
  "@aws-sdk/s3-request-presigner": "3.382.0",
26
- "aws-policies": "^1.0.1",
27
26
  "mime-types": "2.1.34",
28
27
  "zod": "3.22.3",
29
- "@remotion/renderer": "4.0.147",
30
- "@remotion/bundler": "4.0.147",
31
- "remotion": "4.0.147",
32
- "@remotion/cli": "4.0.147"
28
+ "@remotion/bundler": "4.0.149",
29
+ "@remotion/renderer": "4.0.149",
30
+ "@remotion/cli": "4.0.149",
31
+ "remotion": "4.0.149"
33
32
  },
34
33
  "devDependencies": {
35
34
  "@jonny/eslint-config": "3.0.281",
36
35
  "@types/mime-types": "2.1.1",
37
36
  "@types/minimist": "1.2.2",
38
37
  "@types/node": "18.14.6",
39
- "@types/react": "18.2.48",
38
+ "@types/react": "18.3.1",
40
39
  "@types/prompt": "^1.1.0",
41
40
  "eslint": "8.56.0",
42
41
  "prettier": "3.2.5",
@@ -45,11 +44,11 @@
45
44
  "ts-node": "10.9.2",
46
45
  "vitest": "0.31.1",
47
46
  "zip-lib": "^0.7.2",
48
- "@remotion/compositor-linux-arm64-gnu": "4.0.147",
49
- "@remotion/bundler": "4.0.147"
47
+ "@remotion/bundler": "4.0.149",
48
+ "@remotion/compositor-linux-arm64-gnu": "4.0.149"
50
49
  },
51
50
  "peerDependencies": {
52
- "@remotion/bundler": "4.0.147"
51
+ "@remotion/bundler": "4.0.149"
53
52
  },
54
53
  "publishConfig": {
55
54
  "access": "public"
@@ -84,8 +83,7 @@
84
83
  "testintegration": "vitest src/test/integration --run",
85
84
  "lint": "eslint src --ext ts,tsx",
86
85
  "test": "vitest src/test/unit --run",
87
- "watch": "tsc -w",
88
- "build": "tsc -d && pnpm run buildlambda",
86
+ "build": "pnpm run buildlambda",
89
87
  "buildlambda": "ts-node src/admin/bundle-lambda.ts"
90
88
  }
91
89
  }
Binary file
@@ -1,2 +0,0 @@
1
- export declare const nssConfigFile: () => string;
2
- export declare const initNss: () => void;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.initNss = exports.nssConfigFile = void 0;
7
- const fs_1 = require("fs");
8
- const path_1 = __importDefault(require("path"));
9
- // /etc/pki/pkcs11.txt
10
- const nssConfigFile = () => {
11
- return `
12
- library=libnsssysinit.so
13
- name=NSS Internal PKCS #11 Module
14
- parameters=configdir='sql:/tmp/.pki/nssdb' certPrefix='' keyPrefix='' secmod='secmod.db' flags= updatedir='' updateCertPrefix='' updateKeyPrefix='' updateid='' updateTokenDescription=''
15
- NSS=Flags=internal,moduleDBOnly,critical trustOrder=75 cipherOrder=100 slotParams=(1={slotFlags=[RSA,DSA,DH,RC2,RC4,DES,RANDOM,SHA1,MD5,MD2,SSL,TLS,AES,Camellia,SEED,SHA256,SHA512] askpw=any timeout=30})
16
- `.trim();
17
- };
18
- exports.nssConfigFile = nssConfigFile;
19
- const TARGET_DIR = '/tmp/.pki/nssdb';
20
- const TARGET_FILE = path_1.default.join(TARGET_DIR, 'pkcs11.txt');
21
- const TARGET_CERT_DB = path_1.default.join(TARGET_DIR, 'cert9.db');
22
- const TARGET_KEY_DB = path_1.default.join(TARGET_DIR, 'key4.db');
23
- const initNss = () => {
24
- if (!(0, fs_1.existsSync)(TARGET_DIR)) {
25
- (0, fs_1.mkdirSync)(TARGET_DIR, { recursive: true });
26
- }
27
- if (!(0, fs_1.existsSync)(TARGET_FILE)) {
28
- const nssConfig = (0, exports.nssConfigFile)();
29
- (0, fs_1.writeFileSync)(TARGET_FILE, nssConfig);
30
- }
31
- if (!(0, fs_1.existsSync)(TARGET_CERT_DB)) {
32
- (0, fs_1.cpSync)('/opt/nss/cert9.db', TARGET_CERT_DB);
33
- }
34
- if (!(0, fs_1.existsSync)(TARGET_KEY_DB)) {
35
- (0, fs_1.cpSync)('/opt/nss/key4.db', TARGET_KEY_DB);
36
- }
37
- console.log('Written!');
38
- };
39
- exports.initNss = initNss;