@remotion/lambda 3.3.15 → 3.3.16

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.
@@ -4,7 +4,6 @@ exports.getCompositionsOnLambda = void 0;
4
4
  const version_1 = require("remotion/version");
5
5
  const defaults_1 = require("../defaults");
6
6
  const call_lambda_1 = require("../shared/call-lambda");
7
- const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
8
7
  const serialize_input_props_1 = require("../shared/serialize-input-props");
9
8
  /**
10
9
  * @description Returns the compositions from a serveUrl
@@ -21,7 +20,6 @@ const serialize_input_props_1 = require("../shared/serialize-input-props");
21
20
  */
22
21
  const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, }) => {
23
22
  var _a;
24
- const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
25
23
  const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
26
24
  inputProps,
27
25
  region,
@@ -33,7 +31,7 @@ const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inpu
33
31
  type: defaults_1.LambdaRoutines.compositions,
34
32
  payload: {
35
33
  chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
36
- serveUrl: realServeUrl,
34
+ serveUrl,
37
35
  envVariables,
38
36
  inputProps: serializedInputProps,
39
37
  logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
@@ -4,7 +4,6 @@ exports.renderVideoOnLambda = exports.renderMediaOnLambda = void 0;
4
4
  const version_1 = require("remotion/version");
5
5
  const call_lambda_1 = require("../shared/call-lambda");
6
6
  const constants_1 = require("../shared/constants");
7
- const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
8
7
  const get_aws_urls_1 = require("../shared/get-aws-urls");
9
8
  const serialize_input_props_1 = require("../shared/serialize-input-props");
10
9
  const validate_download_behavior_1 = require("../shared/validate-download-behavior");
@@ -39,14 +38,11 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
39
38
  durationInFrames: 1,
40
39
  });
41
40
  (0, validate_download_behavior_1.validateDownloadBehavior)(downloadBehavior);
42
- const [realServeUrl, serializedInputProps] = await Promise.all([
43
- (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region),
44
- (0, serialize_input_props_1.serializeInputProps)({
45
- inputProps,
46
- region,
47
- type: 'video-or-audio',
48
- }),
49
- ]);
41
+ const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
42
+ inputProps,
43
+ region,
44
+ type: 'video-or-audio',
45
+ });
50
46
  try {
51
47
  const res = await (0, call_lambda_1.callLambda)({
52
48
  functionName,
@@ -54,7 +50,7 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
54
50
  payload: {
55
51
  framesPerLambda: framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null,
56
52
  composition,
57
- serveUrl: realServeUrl,
53
+ serveUrl,
58
54
  inputProps: serializedInputProps,
59
55
  codec: actualCodec,
60
56
  imageFormat: imageFormat !== null && imageFormat !== void 0 ? imageFormat : 'jpeg',
@@ -4,7 +4,6 @@ exports.renderStillOnLambda = void 0;
4
4
  const version_1 = require("remotion/version");
5
5
  const call_lambda_1 = require("../shared/call-lambda");
6
6
  const constants_1 = require("../shared/constants");
7
- const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
8
7
  const get_aws_urls_1 = require("../shared/get-aws-urls");
9
8
  const serialize_input_props_1 = require("../shared/serialize-input-props");
10
9
  /**
@@ -25,7 +24,6 @@ const serialize_input_props_1 = require("../shared/serialize-input-props");
25
24
  */
26
25
  const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, }) => {
27
26
  var _a;
28
- const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
29
27
  const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
30
28
  inputProps,
31
29
  region,
@@ -37,7 +35,7 @@ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFo
37
35
  type: constants_1.LambdaRoutines.still,
38
36
  payload: {
39
37
  composition,
40
- serveUrl: realServeUrl,
38
+ serveUrl,
41
39
  inputProps: serializedInputProps,
42
40
  imageFormat,
43
41
  envVariables,
@@ -4,7 +4,6 @@ exports.compositionsCommand = exports.COMPOSITIONS_COMMAND = void 0;
4
4
  const cli_1 = require("@remotion/cli");
5
5
  const __1 = require("../../..");
6
6
  const constants_1 = require("../../../shared/constants");
7
- const convert_to_serve_url_1 = require("../../../shared/convert-to-serve-url");
8
7
  const validate_serveurl_1 = require("../../../shared/validate-serveurl");
9
8
  const get_aws_region_1 = require("../../get-aws-region");
10
9
  const find_function_name_1 = require("../../helpers/find-function-name");
@@ -28,10 +27,9 @@ const compositionsCommand = async (args, remotionRoot) => {
28
27
  const region = (0, get_aws_region_1.getAwsRegion)();
29
28
  (0, validate_serveurl_1.validateServeUrl)(serveUrl);
30
29
  const functionName = await (0, find_function_name_1.findFunctionName)();
31
- const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
32
30
  const comps = await (0, __1.getCompositionsOnLambda)({
33
31
  functionName,
34
- serveUrl: realServeUrl,
32
+ serveUrl,
35
33
  inputProps,
36
34
  region,
37
35
  chromiumOptions,
@@ -7,7 +7,6 @@ const download_media_1 = require("../../../api/download-media");
7
7
  const get_render_progress_1 = require("../../../api/get-render-progress");
8
8
  const render_media_on_lambda_1 = require("../../../api/render-media-on-lambda");
9
9
  const constants_1 = require("../../../shared/constants");
10
- const convert_to_serve_url_1 = require("../../../shared/convert-to-serve-url");
11
10
  const sleep_1 = require("../../../shared/sleep");
12
11
  const validate_frames_per_lambda_1 = require("../../../shared/validate-frames-per-lambda");
13
12
  const validate_privacy_1 = require("../../../shared/validate-privacy");
@@ -35,8 +34,7 @@ const renderCommand = async (args, remotionRoot) => {
35
34
  if (!composition) {
36
35
  log_1.Log.info('No compositions passed. Fetching compositions...');
37
36
  (0, validate_serveurl_1.validateServeUrl)(serveUrl);
38
- const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
39
- const comps = await (0, renderer_1.getCompositions)(realServeUrl);
37
+ const comps = await (0, renderer_1.getCompositions)(serveUrl);
40
38
  const { compositionId } = await cli_1.CliInternals.selectComposition(comps);
41
39
  composition = compositionId;
42
40
  }
@@ -6,7 +6,6 @@ const renderer_1 = require("@remotion/renderer");
6
6
  const download_media_1 = require("../../api/download-media");
7
7
  const render_still_on_lambda_1 = require("../../api/render-still-on-lambda");
8
8
  const constants_1 = require("../../shared/constants");
9
- const convert_to_serve_url_1 = require("../../shared/convert-to-serve-url");
10
9
  const validate_privacy_1 = require("../../shared/validate-privacy");
11
10
  const validate_retries_1 = require("../../shared/validate-retries");
12
11
  const validate_serveurl_1 = require("../../shared/validate-serveurl");
@@ -29,14 +28,11 @@ const stillCommand = async (args, remotionRoot) => {
29
28
  const region = (0, get_aws_region_1.getAwsRegion)();
30
29
  let composition = args[1];
31
30
  if (!composition) {
32
- if (!composition) {
33
- log_1.Log.info('No compositions passed. Fetching compositions...');
34
- (0, validate_serveurl_1.validateServeUrl)(serveUrl);
35
- const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
36
- const comps = await (0, renderer_1.getCompositions)(realServeUrl);
37
- const { compositionId } = await cli_1.CliInternals.selectComposition(comps);
38
- composition = compositionId;
39
- }
31
+ log_1.Log.info('No compositions passed. Fetching compositions...');
32
+ (0, validate_serveurl_1.validateServeUrl)(serveUrl);
33
+ const comps = await (0, renderer_1.getCompositions)(serveUrl);
34
+ const { compositionId } = await cli_1.CliInternals.selectComposition(comps);
35
+ composition = compositionId;
40
36
  }
41
37
  const downloadName = (_a = args[2]) !== null && _a !== void 0 ? _a : null;
42
38
  const outName = args_1.parsedLambdaCli['out-name'];
@@ -5,6 +5,7 @@ const renderer_1 = require("@remotion/renderer");
5
5
  const version_1 = require("remotion/version");
6
6
  const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
7
7
  const defaults_1 = require("../defaults");
8
+ const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
8
9
  const deserialize_input_props_1 = require("../shared/deserialize-input-props");
9
10
  const get_browser_instance_1 = require("./helpers/get-browser-instance");
10
11
  const get_current_region_1 = require("./helpers/get-current-region");
@@ -19,9 +20,10 @@ const compositionsHandler = async (lambdaParams, options) => {
19
20
  }
20
21
  throw new Error(`Version mismatch: When calling getCompositionsOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call getCompositionsOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
21
22
  }
23
+ const region = (0, get_current_region_1.getCurrentRegionInFunction)();
22
24
  const [{ bucketName }, browserInstance] = await Promise.all([
23
25
  (0, get_or_create_bucket_1.getOrCreateBucket)({
24
- region: (0, get_current_region_1.getCurrentRegionInFunction)(),
26
+ region,
25
27
  }),
26
28
  (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'), (_a = lambdaParams.chromiumOptions) !== null && _a !== void 0 ? _a : {}),
27
29
  ]);
@@ -31,10 +33,15 @@ const compositionsHandler = async (lambdaParams, options) => {
31
33
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
32
34
  serialized: lambdaParams.inputProps,
33
35
  });
36
+ const realServeUrl = (0, convert_to_serve_url_1.convertToServeUrl)({
37
+ urlOrId: lambdaParams.serveUrl,
38
+ region,
39
+ bucketName,
40
+ });
34
41
  const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
35
- const compositions = await (0, renderer_1.getCompositions)(lambdaParams.serveUrl, {
42
+ const compositions = await (0, renderer_1.getCompositions)(realServeUrl, {
36
43
  puppeteerInstance: browserInstance,
37
- inputProps: inputProps,
44
+ inputProps,
38
45
  envVariables: lambdaParams.envVariables,
39
46
  ffmpegExecutable: null,
40
47
  ffprobeExecutable: null,
@@ -6,6 +6,7 @@ const version_1 = require("remotion/version");
6
6
  const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
7
7
  const aws_clients_1 = require("../shared/aws-clients");
8
8
  const constants_1 = require("../shared/constants");
9
+ const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
9
10
  const random_hash_1 = require("../shared/random-hash");
10
11
  const get_current_region_1 = require("./helpers/get-current-region");
11
12
  const io_1 = require("./helpers/io");
@@ -20,14 +21,20 @@ const startHandler = async (params, options) => {
20
21
  }
21
22
  throw new Error(`Version mismatch: When calling renderMediaOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${params.version}. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
22
23
  }
24
+ const region = (0, get_current_region_1.getCurrentRegionInFunction)();
23
25
  const { bucketName } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
24
26
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
25
27
  });
28
+ const realServeUrl = (0, convert_to_serve_url_1.convertToServeUrl)({
29
+ urlOrId: params.serveUrl,
30
+ region,
31
+ bucketName,
32
+ });
26
33
  const renderId = (0, random_hash_1.randomHash)({ randomInTests: true });
27
34
  const initialFile = (0, io_1.lambdaWriteFile)({
28
35
  bucketName,
29
36
  downloadBehavior: null,
30
- region: (0, get_current_region_1.getCurrentRegionInFunction)(),
37
+ region,
31
38
  body: 'Render was initialized',
32
39
  expectedBucketOwner: options.expectedBucketOwner,
33
40
  key: (0, constants_1.initalizedMetadataKey)(renderId),
@@ -38,7 +45,7 @@ const startHandler = async (params, options) => {
38
45
  type: constants_1.LambdaRoutines.launch,
39
46
  framesPerLambda: params.framesPerLambda,
40
47
  composition: params.composition,
41
- serveUrl: params.serveUrl,
48
+ serveUrl: realServeUrl,
42
49
  inputProps: params.inputProps,
43
50
  bucketName,
44
51
  renderId,
@@ -14,6 +14,7 @@ const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
14
14
  const aws_clients_1 = require("../shared/aws-clients");
15
15
  const cleanup_serialized_input_props_1 = require("../shared/cleanup-serialized-input-props");
16
16
  const constants_1 = require("../shared/constants");
17
+ const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
17
18
  const deserialize_input_props_1 = require("../shared/deserialize-input-props");
18
19
  const make_s3_url_1 = require("../shared/make-s3-url");
19
20
  const random_hash_1 = require("../shared/random-hash");
@@ -53,14 +54,20 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
53
54
  const outputDir = renderer_1.RenderInternals.tmpDir('remotion-render-');
54
55
  const outputPath = path_1.default.join(outputDir, 'output');
55
56
  const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
57
+ const region = (0, get_current_region_1.getCurrentRegionInFunction)();
56
58
  const inputProps = await (0, deserialize_input_props_1.deserializeInputProps)({
57
59
  bucketName,
58
60
  expectedBucketOwner: options.expectedBucketOwner,
59
- region: (0, get_current_region_1.getCurrentRegionInFunction)(),
61
+ region,
60
62
  serialized: lambdaParams.inputProps,
61
63
  });
64
+ const serveUrl = (0, convert_to_serve_url_1.convertToServeUrl)({
65
+ urlOrId: lambdaParams.serveUrl,
66
+ region,
67
+ bucketName,
68
+ });
62
69
  const composition = await (0, validate_composition_1.validateComposition)({
63
- serveUrl: lambdaParams.serveUrl,
70
+ serveUrl,
64
71
  browserInstance,
65
72
  composition: lambdaParams.composition,
66
73
  inputProps,
@@ -81,7 +88,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
81
88
  compositionId: lambdaParams.composition,
82
89
  estimatedTotalLambdaInvokations: 1,
83
90
  estimatedRenderLambdaInvokations: 1,
84
- siteId: (0, make_s3_url_1.getServeUrlHash)(lambdaParams.serveUrl),
91
+ siteId: (0, make_s3_url_1.getServeUrlHash)(serveUrl),
85
92
  totalChunks: 1,
86
93
  type: 'still',
87
94
  imageFormat: lambdaParams.imageFormat,
@@ -109,7 +116,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
109
116
  await (0, renderer_1.renderStill)({
110
117
  composition,
111
118
  output: outputPath,
112
- serveUrl: lambdaParams.serveUrl,
119
+ serveUrl,
113
120
  dumpBrowserLogs: false,
114
121
  envVariables: lambdaParams.envVariables,
115
122
  frame: renderer_1.RenderInternals.convertToPositiveFrameIndex({
@@ -1,2 +1,6 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
- export declare const convertToServeUrl: (urlOrId: string, region: AwsRegion) => Promise<string>;
2
+ export declare const convertToServeUrl: ({ urlOrId, region, bucketName, }: {
3
+ urlOrId: string;
4
+ region: AwsRegion;
5
+ bucketName: string;
6
+ }) => string;
@@ -1,18 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertToServeUrl = void 0;
4
- const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
5
4
  const docs_url_1 = require("./docs-url");
6
- const convertToServeUrl = async (urlOrId, region) => {
5
+ const convertToServeUrl = ({ urlOrId, region, bucketName, }) => {
7
6
  if (urlOrId.startsWith('src/')) {
8
7
  throw new Error(`Remotion Lambda can only render based on a URL in the cloud. It seems like you passed a local file: ${urlOrId}. Read the setup guide for Remotion Lambda ${docs_url_1.DOCS_URL}/docs/lambda/setup`);
9
8
  }
10
9
  if (urlOrId.startsWith('http://') || urlOrId.startsWith('https://')) {
11
10
  return urlOrId;
12
11
  }
13
- const { bucketName } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
14
- region,
15
- });
16
12
  return `https://${bucketName}.s3.${region}.amazonaws.com/sites/${urlOrId}/index.html`;
17
13
  };
18
14
  exports.convertToServeUrl = convertToServeUrl;
@@ -5,4 +5,4 @@ export declare const deserializeInputProps: ({ serialized, region, bucketName, e
5
5
  region: AwsRegion;
6
6
  bucketName: string;
7
7
  expectedBucketOwner: string;
8
- }) => Promise<unknown>;
8
+ }) => Promise<object>;
@@ -20,7 +20,7 @@ const deserializeInputProps = async ({ serialized, region, bucketName, expectedB
20
20
  return payload;
21
21
  }
22
22
  catch (err) {
23
- throw new Error('Failed to parse input props that were');
23
+ throw new Error(`Failed to parse input props that were serialized: ${err.stack}`);
24
24
  }
25
25
  };
26
26
  exports.deserializeInputProps = deserializeInputProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "3.3.15",
3
+ "version": "3.3.16",
4
4
  "description": "Distributed renderer for Remotion based on AWS Lambda",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -33,12 +33,12 @@
33
33
  "@aws-sdk/credential-providers": "3.215.0",
34
34
  "@aws-sdk/lib-storage": "3.215.0",
35
35
  "@aws-sdk/s3-request-presigner": "3.215.0",
36
- "@remotion/bundler": "3.3.15",
37
- "@remotion/cli": "3.3.15",
38
- "@remotion/renderer": "3.3.15",
36
+ "@remotion/bundler": "3.3.16",
37
+ "@remotion/cli": "3.3.16",
38
+ "@remotion/renderer": "3.3.16",
39
39
  "aws-policies": "^1.0.1",
40
40
  "mime-types": "2.1.34",
41
- "remotion": "3.3.15"
41
+ "remotion": "3.3.16"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "react": ">=16.8.0",
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "2fc46f12fd00b0f4eace6398e5eaa054210928ea"
64
+ "gitHead": "f9ad91106fe6fbcc61a25d917cc526a995d9322c"
65
65
  }
Binary file