@remotion/lambda-client 4.0.314 → 4.0.316

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 (93) hide show
  1. package/.turbo/turbo-make.log +2 -2
  2. package/dist/aws-clients.d.ts +6 -5
  3. package/dist/aws-clients.js +10 -5
  4. package/dist/aws-provider.d.ts +2 -0
  5. package/dist/bucket-exists.js +2 -1
  6. package/dist/call-lambda-async.js +1 -1
  7. package/dist/call-lambda-streaming.js +1 -1
  8. package/dist/call-lambda-sync.js +1 -1
  9. package/dist/clean-items.d.ts +2 -1
  10. package/dist/clean-items.js +2 -1
  11. package/dist/create-bucket.js +25 -5
  12. package/dist/delete-file.js +7 -2
  13. package/dist/delete-function.d.ts +4 -1
  14. package/dist/delete-function.js +2 -2
  15. package/dist/delete-render.d.ts +2 -0
  16. package/dist/delete-render.js +7 -1
  17. package/dist/esm/index.mjs +858 -823
  18. package/dist/get-account-id.js +1 -1
  19. package/dist/get-aws-client.d.ts +3 -1
  20. package/dist/get-aws-client.js +2 -1
  21. package/dist/get-buckets.js +3 -1
  22. package/dist/get-compositions-on-lambda.d.ts +3 -1
  23. package/dist/get-compositions-on-lambda.js +3 -1
  24. package/dist/get-function-version.d.ts +3 -1
  25. package/dist/get-function-version.js +4 -1
  26. package/dist/get-functions.d.ts +2 -0
  27. package/dist/get-functions.js +5 -2
  28. package/dist/get-render-progress.d.ts +2 -0
  29. package/dist/get-render-progress.js +2 -0
  30. package/dist/get-s3-client.d.ts +3 -1
  31. package/dist/get-s3-client.js +2 -1
  32. package/dist/get-service-client.d.ts +3 -1
  33. package/dist/get-service-client.js +13 -5
  34. package/dist/get-sites.d.ts +4 -2
  35. package/dist/get-sites.js +6 -2
  36. package/dist/head-file.js +2 -1
  37. package/dist/index.d.ts +14 -10
  38. package/dist/is-flaky-error.js +2 -1
  39. package/dist/lifecycle-rules.d.ts +3 -1
  40. package/dist/lifecycle-rules.js +17 -5
  41. package/dist/list-objects.js +4 -1
  42. package/dist/make-lambda-payload.d.ts +4 -2
  43. package/dist/make-lambda-payload.js +4 -2
  44. package/dist/presign-url.d.ts +5 -2
  45. package/dist/presign-url.js +4 -2
  46. package/dist/read-file.d.ts +3 -1
  47. package/dist/read-file.js +2 -1
  48. package/dist/render-media-on-lambda.d.ts +2 -0
  49. package/dist/render-media-on-lambda.js +3 -1
  50. package/dist/render-still-on-lambda.d.ts +5 -1
  51. package/dist/render-still-on-lambda.js +3 -1
  52. package/dist/test/request-handler.test.d.ts +1 -0
  53. package/dist/test/request-handler.test.js +36 -0
  54. package/dist/types.d.ts +4 -0
  55. package/dist/types.js +2 -0
  56. package/dist/write-file.js +2 -1
  57. package/package.json +3 -3
  58. package/src/aws-clients.ts +18 -3
  59. package/src/aws-provider.ts +2 -0
  60. package/src/bucket-exists.ts +8 -1
  61. package/src/call-lambda-async.ts +5 -1
  62. package/src/call-lambda-streaming.ts +5 -1
  63. package/src/call-lambda-sync.ts +5 -1
  64. package/src/clean-items.ts +3 -0
  65. package/src/create-bucket.ts +25 -5
  66. package/src/delete-file.ts +9 -1
  67. package/src/delete-function.ts +6 -2
  68. package/src/delete-render.ts +8 -1
  69. package/src/get-account-id.ts +1 -1
  70. package/src/get-aws-client.ts +4 -0
  71. package/src/get-buckets.ts +3 -0
  72. package/src/get-compositions-on-lambda.ts +5 -0
  73. package/src/get-function-version.ts +6 -0
  74. package/src/get-functions.ts +12 -1
  75. package/src/get-render-progress.ts +4 -0
  76. package/src/get-s3-client.ts +4 -0
  77. package/src/get-service-client.ts +17 -3
  78. package/src/get-sites.ts +8 -0
  79. package/src/head-file.ts +2 -0
  80. package/src/index.ts +1 -0
  81. package/src/is-flaky-error.ts +4 -1
  82. package/src/lifecycle-rules.ts +21 -6
  83. package/src/list-objects.ts +4 -0
  84. package/src/make-lambda-payload.ts +6 -0
  85. package/src/presign-url.ts +13 -2
  86. package/src/read-file.ts +4 -0
  87. package/src/render-media-on-lambda.ts +4 -0
  88. package/src/render-still-on-lambda.ts +7 -1
  89. package/src/test/request-handler.test.ts +42 -0
  90. package/src/types.ts +7 -0
  91. package/src/write-file.ts +2 -0
  92. package/tsconfig.tsbuildinfo +1 -1
  93. package/.turbo/turbo-test.log +0 -23
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.lambdaLsImplementation = void 0;
4
4
  const client_s3_1 = require("@aws-sdk/client-s3");
5
5
  const get_s3_client_1 = require("./get-s3-client");
6
- const lambdaLsImplementation = async ({ bucketName, prefix, region, expectedBucketOwner, continuationToken, forcePathStyle, }) => {
6
+ const lambdaLsImplementation = async ({ bucketName, prefix, region, expectedBucketOwner, continuationToken, forcePathStyle, requestHandler, }) => {
7
7
  var _a, _b, _c, _d;
8
8
  try {
9
9
  const list = await (0, get_s3_client_1.getS3Client)({
10
10
  region,
11
11
  customCredentials: null,
12
12
  forcePathStyle,
13
+ requestHandler,
13
14
  }).send(new client_s3_1.ListObjectsV2Command({
14
15
  Bucket: bucketName,
15
16
  Prefix: prefix,
@@ -33,6 +34,7 @@ const lambdaLsImplementation = async ({ bucketName, prefix, region, expectedBuck
33
34
  region,
34
35
  continuationToken: list.NextContinuationToken,
35
36
  forcePathStyle,
37
+ requestHandler,
36
38
  })),
37
39
  ];
38
40
  }
@@ -55,6 +57,7 @@ const lambdaLsImplementation = async ({ bucketName, prefix, region, expectedBuck
55
57
  region,
56
58
  customCredentials: null,
57
59
  forcePathStyle,
60
+ requestHandler,
58
61
  }).send(new client_s3_1.ListObjectsV2Command({
59
62
  Bucket: bucketName,
60
63
  Prefix: prefix,
@@ -5,6 +5,7 @@ import type { StorageClass } from '@aws-sdk/client-s3';
5
5
  import type { GetRenderProgressInput } from './get-render-progress';
6
6
  import type { AwsRegion } from './regions';
7
7
  import type { RenderStillOnLambdaNonNullInput } from './render-still-on-lambda';
8
+ import type { RequestHandler } from './types';
8
9
  export type InnerRenderMediaOnLambdaInput = {
9
10
  region: AwsRegion;
10
11
  functionName: string;
@@ -50,7 +51,8 @@ export type InnerRenderMediaOnLambdaInput = {
50
51
  forcePathStyle: boolean;
51
52
  metadata: Record<string, string> | null;
52
53
  storageClass: StorageClass | null;
54
+ requestHandler: RequestHandler | null;
53
55
  } & ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>;
54
- export declare const 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, forcePathStyle, metadata, apiKey, offthreadVideoThreads, storageClass, }: InnerRenderMediaOnLambdaInput) => Promise<ServerlessStartPayload<AwsProvider>>;
56
+ export declare const 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, forcePathStyle, metadata, apiKey, offthreadVideoThreads, storageClass, requestHandler, }: InnerRenderMediaOnLambdaInput) => Promise<ServerlessStartPayload<AwsProvider>>;
55
57
  export declare const getRenderProgressPayload: ({ bucketName, renderId, s3OutputProvider, logLevel, forcePathStyle, }: GetRenderProgressInput) => ServerlessStatusPayload<AwsProvider>;
56
- export declare const makeLambdaRenderStillPayload: ({ serveUrl, inputProps, imageFormat, envVariables, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, offthreadVideoCacheSizeInBytes, deleteAfter, forcePathStyle, apiKey, storageClass, }: RenderStillOnLambdaNonNullInput) => Promise<ServerlessPayloads<AwsProvider>[ServerlessRoutines.still]>;
58
+ export declare const makeLambdaRenderStillPayload: ({ serveUrl, inputProps, imageFormat, envVariables, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, offthreadVideoCacheSizeInBytes, deleteAfter, forcePathStyle, apiKey, storageClass, requestHandler, }: RenderStillOnLambdaNonNullInput) => Promise<ServerlessPayloads<AwsProvider>[ServerlessRoutines.still]>;
@@ -6,7 +6,7 @@ const aws_provider_1 = require("./aws-provider");
6
6
  const serverless_client_2 = require("@remotion/serverless-client");
7
7
  const validate_lambda_codec_1 = require("./validate-lambda-codec");
8
8
  const validate_serveurl_1 = require("./validate-serveurl");
9
- const makeLambdaRenderMediaPayload = async ({ 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, forcePathStyle, metadata, apiKey, offthreadVideoThreads, storageClass, }) => {
9
+ const makeLambdaRenderMediaPayload = async ({ 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, forcePathStyle, metadata, apiKey, offthreadVideoThreads, storageClass, requestHandler, }) => {
10
10
  const actualCodec = (0, validate_lambda_codec_1.validateLambdaCodec)(codec);
11
11
  (0, validate_serveurl_1.validateServeUrl)(serveUrl);
12
12
  (0, serverless_client_1.validateFramesPerFunction)({
@@ -32,6 +32,7 @@ const makeLambdaRenderMediaPayload = async ({ rendererFunctionName, frameRange,
32
32
  providerSpecifics: aws_provider_1.awsImplementation,
33
33
  forcePathStyle: forcePathStyle !== null && forcePathStyle !== void 0 ? forcePathStyle : false,
34
34
  skipPutAcl: privacy === 'no-acl',
35
+ requestHandler: requestHandler !== null && requestHandler !== void 0 ? requestHandler : null,
35
36
  });
36
37
  return {
37
38
  rendererFunctionName,
@@ -96,7 +97,7 @@ const getRenderProgressPayload = ({ bucketName, renderId, s3OutputProvider, logL
96
97
  };
97
98
  };
98
99
  exports.getRenderProgressPayload = getRenderProgressPayload;
99
- const makeLambdaRenderStillPayload = async ({ serveUrl, inputProps, imageFormat, envVariables, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, offthreadVideoCacheSizeInBytes, deleteAfter, forcePathStyle, apiKey, storageClass, }) => {
100
+ const makeLambdaRenderStillPayload = async ({ serveUrl, inputProps, imageFormat, envVariables, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, offthreadVideoCacheSizeInBytes, deleteAfter, forcePathStyle, apiKey, storageClass, requestHandler, }) => {
100
101
  const stringifiedInputProps = (0, serverless_client_1.serializeOrThrow)(inputProps, 'input-props');
101
102
  const serializedInputProps = await (0, serverless_client_1.compressInputProps)({
102
103
  stringifiedInputProps,
@@ -114,6 +115,7 @@ const makeLambdaRenderStillPayload = async ({ serveUrl, inputProps, imageFormat,
114
115
  providerSpecifics: aws_provider_1.awsImplementation,
115
116
  forcePathStyle,
116
117
  skipPutAcl: privacy === 'no-acl',
118
+ requestHandler,
117
119
  });
118
120
  return {
119
121
  composition,
@@ -1,4 +1,5 @@
1
1
  import type { AwsRegion } from './regions';
2
+ import type { RequestHandler } from './types';
2
3
  type MandatoryParameters = {
3
4
  region: AwsRegion;
4
5
  bucketName: string;
@@ -9,6 +10,8 @@ type OptionalParameters<CheckIfObjectExists extends boolean> = {
9
10
  checkIfObjectExists: CheckIfObjectExists;
10
11
  forcePathStyle: boolean;
11
12
  };
12
- export type PresignUrlInput<CheckIfObjectExists extends boolean = boolean> = MandatoryParameters & Partial<OptionalParameters<CheckIfObjectExists>>;
13
- export declare const presignUrl: <CheckIfObjectExists extends boolean = false>({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, forcePathStyle, }: PresignUrlInput<CheckIfObjectExists>) => Promise<CheckIfObjectExists extends true ? string | null : string>;
13
+ export type PresignUrlInput<CheckIfObjectExists extends boolean = boolean> = MandatoryParameters & Partial<OptionalParameters<CheckIfObjectExists>> & {
14
+ requestHandler?: RequestHandler;
15
+ };
16
+ export declare const presignUrl: <CheckIfObjectExists extends boolean = false>({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, forcePathStyle, requestHandler, }: PresignUrlInput<CheckIfObjectExists>) => Promise<CheckIfObjectExists extends true ? string | null : string>;
14
17
  export {};
@@ -7,7 +7,7 @@ const serverless_client_1 = require("@remotion/serverless-client");
7
7
  const constants_1 = require("./constants");
8
8
  const get_s3_client_1 = require("./get-s3-client");
9
9
  const validate_presign_expiration_1 = require("./validate-presign-expiration");
10
- const internalPresignUrl = async ({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, forcePathStyle, }) => {
10
+ const internalPresignUrl = async ({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, forcePathStyle, requestHandler, }) => {
11
11
  (0, serverless_client_1.validateBucketName)({
12
12
  bucketName,
13
13
  bucketNamePrefix: constants_1.REMOTION_BUCKET_PREFIX,
@@ -18,6 +18,7 @@ const internalPresignUrl = async ({ region, bucketName, objectKey, checkIfObject
18
18
  region,
19
19
  customCredentials: null,
20
20
  forcePathStyle,
21
+ requestHandler: requestHandler !== null && requestHandler !== void 0 ? requestHandler : null,
21
22
  });
22
23
  if (checkIfObjectExists === true) {
23
24
  try {
@@ -51,7 +52,7 @@ const internalPresignUrl = async ({ region, bucketName, objectKey, checkIfObject
51
52
  * @description Takes a private S3 object and turns it into a public URL by signing it with your AWS credentials.
52
53
  * @see [Documentation](https://remotion.dev/docs/lambda/presignurl)
53
54
  */
54
- const presignUrl = ({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, forcePathStyle, }) => {
55
+ const presignUrl = ({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, forcePathStyle, requestHandler, }) => {
55
56
  return internalPresignUrl({
56
57
  region,
57
58
  bucketName,
@@ -59,6 +60,7 @@ const presignUrl = ({ region, bucketName, objectKey, checkIfObjectExists, expire
59
60
  checkIfObjectExists: checkIfObjectExists !== null && checkIfObjectExists !== void 0 ? checkIfObjectExists : false,
60
61
  expiresInSeconds,
61
62
  forcePathStyle: forcePathStyle !== null && forcePathStyle !== void 0 ? forcePathStyle : false,
63
+ requestHandler,
62
64
  });
63
65
  };
64
66
  exports.presignUrl = presignUrl;
@@ -1,9 +1,11 @@
1
1
  import type { Readable } from 'stream';
2
2
  import type { AwsRegion } from './regions';
3
- export declare const lambdaReadFileImplementation: ({ bucketName, key, region, expectedBucketOwner, forcePathStyle, }: {
3
+ import type { RequestHandler } from './types';
4
+ export declare const lambdaReadFileImplementation: ({ bucketName, key, region, expectedBucketOwner, forcePathStyle, requestHandler, }: {
4
5
  bucketName: string;
5
6
  key: string;
6
7
  region: AwsRegion;
7
8
  expectedBucketOwner: string | null;
8
9
  forcePathStyle: boolean;
10
+ requestHandler: RequestHandler | null;
9
11
  }) => Promise<Readable>;
package/dist/read-file.js CHANGED
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.lambdaReadFileImplementation = void 0;
4
4
  const client_s3_1 = require("@aws-sdk/client-s3");
5
5
  const get_s3_client_1 = require("./get-s3-client");
6
- const lambdaReadFileImplementation = async ({ bucketName, key, region, expectedBucketOwner, forcePathStyle, }) => {
6
+ const lambdaReadFileImplementation = async ({ bucketName, key, region, expectedBucketOwner, forcePathStyle, requestHandler, }) => {
7
7
  const { Body } = await (0, get_s3_client_1.getS3Client)({
8
8
  region,
9
9
  customCredentials: null,
10
10
  forcePathStyle,
11
+ requestHandler,
11
12
  }).send(new client_s3_1.GetObjectCommand({
12
13
  Bucket: bucketName,
13
14
  Key: key,
@@ -3,6 +3,7 @@ import type { AudioCodec, BrowserSafeApis, ChromiumOptions, DownloadBehavior, Fr
3
3
  import { type AwsProvider } from './aws-provider';
4
4
  import type { InnerRenderMediaOnLambdaInput } from './make-lambda-payload';
5
5
  import type { AwsRegion } from './regions';
6
+ import type { RequestHandler } from './types';
6
7
  export type RenderMediaOnLambdaInput = {
7
8
  region: AwsRegion;
8
9
  functionName: string;
@@ -44,6 +45,7 @@ export type RenderMediaOnLambdaInput = {
44
45
  forcePathStyle?: boolean;
45
46
  metadata?: Record<string, string> | null;
46
47
  storageClass?: StorageClass | null;
48
+ requestHandler?: RequestHandler;
47
49
  } & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>>;
48
50
  export type RenderMediaOnLambdaOutput = {
49
51
  renderId: string;
@@ -15,6 +15,7 @@ const internalRenderMediaOnLambdaRaw = async (input) => {
15
15
  payload: await (0, make_lambda_payload_1.makeLambdaRenderMediaPayload)(input),
16
16
  region,
17
17
  timeoutInTest: 120000,
18
+ requestHandler: input.requestHandler,
18
19
  });
19
20
  return {
20
21
  renderId: res.renderId,
@@ -58,7 +59,7 @@ const internalRenderMediaOnLambdaRaw = async (input) => {
58
59
  };
59
60
  exports.internalRenderMediaOnLambdaRaw = internalRenderMediaOnLambdaRaw;
60
61
  const renderMediaOnLambdaOptionalToRequired = (options) => {
61
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;
62
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17;
62
63
  return {
63
64
  offthreadVideoThreads: (_a = options.offthreadVideoThreads) !== null && _a !== void 0 ? _a : null,
64
65
  audioBitrate: (_b = options.audioBitrate) !== null && _b !== void 0 ? _b : null,
@@ -108,6 +109,7 @@ const renderMediaOnLambdaOptionalToRequired = (options) => {
108
109
  metadata: (_14 = options.metadata) !== null && _14 !== void 0 ? _14 : null,
109
110
  apiKey: (_15 = options.apiKey) !== null && _15 !== void 0 ? _15 : null,
110
111
  storageClass: (_16 = options.storageClass) !== null && _16 !== void 0 ? _16 : null,
112
+ requestHandler: (_17 = options.requestHandler) !== null && _17 !== void 0 ? _17 : null,
111
113
  };
112
114
  };
113
115
  exports.renderMediaOnLambdaOptionalToRequired = renderMediaOnLambdaOptionalToRequired;
@@ -3,6 +3,7 @@ import type { StorageClass } from '@aws-sdk/client-s3';
3
3
  import type { CostsInfo, OutNameInput, Privacy, ReceivedArtifact } from '@remotion/serverless-client';
4
4
  import { type AwsProvider } from './aws-provider';
5
5
  import type { AwsRegion } from './regions';
6
+ import type { RequestHandler } from './types';
6
7
  type MandatoryParameters = {
7
8
  region: AwsRegion;
8
9
  functionName: string;
@@ -30,9 +31,12 @@ type OptionalParameters = {
30
31
  indent: boolean;
31
32
  forcePathStyle: boolean;
32
33
  storageClass: StorageClass | null;
34
+ requestHandler: RequestHandler | null | undefined;
33
35
  } & ToOptions<typeof BrowserSafeApis.optionsMap.renderStillOnLambda>;
34
36
  export type RenderStillOnLambdaNonNullInput = MandatoryParameters & OptionalParameters;
35
- export type RenderStillOnLambdaInput = MandatoryParameters & Partial<OptionalParameters>;
37
+ export type RenderStillOnLambdaInput = MandatoryParameters & Partial<OptionalParameters> & {
38
+ requestHandler?: RequestHandler;
39
+ };
36
40
  export type RenderStillOnLambdaOutput = {
37
41
  estimatedPrice: CostsInfo;
38
42
  url: string;
@@ -45,6 +45,7 @@ const innerRenderStillOnLambda = async (input) => {
45
45
  },
46
46
  timeoutInTest: 120000,
47
47
  retriesRemaining: input.maxRetries,
48
+ requestHandler: input.requestHandler,
48
49
  })
49
50
  .then(() => {
50
51
  reject(new Error('Expected response to be streamed'));
@@ -83,7 +84,7 @@ exports.internalRenderStillOnLambda = (0, serverless_client_2.wrapWithErrorHandl
83
84
  * @see [Documentation](https://remotion.dev/docs/lambda/renderstillonlambda)
84
85
  */
85
86
  const renderStillOnLambda = (input) => {
86
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
87
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
87
88
  return (0, exports.internalRenderStillOnLambda)({
88
89
  chromiumOptions: (_a = input.chromiumOptions) !== null && _a !== void 0 ? _a : {},
89
90
  composition: input.composition,
@@ -113,6 +114,7 @@ const renderStillOnLambda = (input) => {
113
114
  apiKey: (_u = input.apiKey) !== null && _u !== void 0 ? _u : null,
114
115
  offthreadVideoThreads: (_v = input.offthreadVideoThreads) !== null && _v !== void 0 ? _v : null,
115
116
  storageClass: (_w = input.storageClass) !== null && _w !== void 0 ? _w : null,
117
+ requestHandler: (_x = input.requestHandler) !== null && _x !== void 0 ? _x : null,
116
118
  });
117
119
  };
118
120
  exports.renderStillOnLambda = renderStillOnLambda;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const bun_test_1 = require("bun:test");
4
+ (0, bun_test_1.test)('RequestHandler type should be properly exported and defined', () => {
5
+ // Just verify the type can be imported
6
+ const requestHandler = {
7
+ httpsAgent: {
8
+ maxSockets: 100,
9
+ },
10
+ };
11
+ (0, bun_test_1.expect)(requestHandler).toBeDefined();
12
+ (0, bun_test_1.expect)(typeof requestHandler).toBe('object');
13
+ });
14
+ (0, bun_test_1.test)('API input types should accept requestHandler option', () => {
15
+ // Test that the type checking works for various API inputs
16
+ const getAwsClientInput = {
17
+ region: 'us-east-1',
18
+ service: 'lambda',
19
+ requestHandler: {
20
+ httpsAgent: {
21
+ maxSockets: 50,
22
+ },
23
+ },
24
+ };
25
+ const getFunctionsInput = {
26
+ region: 'us-east-1',
27
+ compatibleOnly: false,
28
+ requestHandler: {
29
+ httpsAgent: {
30
+ maxSockets: 25,
31
+ },
32
+ },
33
+ };
34
+ (0, bun_test_1.expect)(getAwsClientInput.requestHandler).toBeDefined();
35
+ (0, bun_test_1.expect)(getFunctionsInput.requestHandler).toBeDefined();
36
+ });
@@ -0,0 +1,4 @@
1
+ import type { LambdaClient } from '@aws-sdk/client-lambda';
2
+ type LambdaClientConfig = NonNullable<ConstructorParameters<typeof LambdaClient>[0]>;
3
+ export type RequestHandler = LambdaClientConfig['requestHandler'];
4
+ export {};
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -11,11 +11,12 @@ const content_disposition_header_1 = require("./content-disposition-header");
11
11
  const get_s3_client_1 = require("./get-s3-client");
12
12
  // Files larger than 100MB will use multipart upload
13
13
  const MULTIPART_THRESHOLD = 100 * 1024 * 1024; // 5MB in bytes
14
- const tryLambdaWriteFile = async ({ bucketName, key, body, region, privacy, expectedBucketOwner, downloadBehavior, customCredentials, forcePathStyle, storageClass, }) => {
14
+ const tryLambdaWriteFile = async ({ bucketName, key, body, region, privacy, expectedBucketOwner, downloadBehavior, customCredentials, forcePathStyle, storageClass, requestHandler, }) => {
15
15
  const client = (0, get_s3_client_1.getS3Client)({
16
16
  region,
17
17
  customCredentials: customCredentials,
18
18
  forcePathStyle,
19
+ requestHandler,
19
20
  });
20
21
  const params = {
21
22
  Bucket: bucketName,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/lambda-client"
4
4
  },
5
5
  "name": "@remotion/lambda-client",
6
- "version": "4.0.314",
6
+ "version": "4.0.316",
7
7
  "main": "dist/index.js",
8
8
  "sideEffects": false,
9
9
  "author": "Jonny Burger <jonny@remotion.dev>",
@@ -26,8 +26,8 @@
26
26
  "eslint": "9.19.0",
27
27
  "next": "15.2.4",
28
28
  "@types/mime-types": "2.1.1",
29
- "@remotion/serverless-client": "4.0.314",
30
- "@remotion/eslint-config-internal": "4.0.314"
29
+ "@remotion/serverless-client": "4.0.316",
30
+ "@remotion/eslint-config-internal": "4.0.316"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
@@ -5,56 +5,71 @@ import type {ServiceQuotasClient} from '@aws-sdk/client-service-quotas';
5
5
  import type {STSClient} from '@aws-sdk/client-sts';
6
6
  import {getServiceClient} from './get-service-client';
7
7
  import type {AwsRegion} from './regions';
8
+ import type {RequestHandler} from './types';
8
9
 
9
10
  export const getCloudWatchLogsClient = (
10
11
  region: AwsRegion,
12
+ requestHandler: RequestHandler | null,
11
13
  ): CloudWatchLogsClient => {
12
14
  return getServiceClient({
13
15
  region,
14
16
  service: 'cloudwatch',
15
17
  customCredentials: null,
16
18
  forcePathStyle: false,
19
+ requestHandler,
17
20
  });
18
21
  };
19
22
 
20
23
  export const getLambdaClient = (
21
24
  region: AwsRegion,
22
25
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
23
- _timeoutInTest?: number,
26
+ _timeoutInTest: number | undefined,
27
+ requestHandler: RequestHandler | null,
24
28
  ): LambdaClient => {
25
29
  return getServiceClient({
26
30
  region,
27
31
  service: 'lambda',
28
32
  customCredentials: null,
29
33
  forcePathStyle: false,
34
+ requestHandler,
30
35
  });
31
36
  };
32
37
 
33
- export const getIamClient = (region: AwsRegion): IAMClient => {
38
+ export const getIamClient = (
39
+ region: AwsRegion,
40
+ requestHandler: RequestHandler | null,
41
+ ): IAMClient => {
34
42
  return getServiceClient({
35
43
  region,
36
44
  service: 'iam',
37
45
  customCredentials: null,
38
46
  forcePathStyle: false,
47
+ requestHandler,
39
48
  });
40
49
  };
41
50
 
42
51
  export const getServiceQuotasClient = (
43
52
  region: AwsRegion,
53
+ requestHandler: RequestHandler | null,
44
54
  ): ServiceQuotasClient => {
45
55
  return getServiceClient({
46
56
  region,
47
57
  service: 'servicequotas',
48
58
  customCredentials: null,
49
59
  forcePathStyle: false,
60
+ requestHandler,
50
61
  });
51
62
  };
52
63
 
53
- export const getStsClient = (region: AwsRegion): STSClient => {
64
+ export const getStsClient = (
65
+ region: AwsRegion,
66
+ requestHandler: RequestHandler | null,
67
+ ): STSClient => {
54
68
  return getServiceClient({
55
69
  region,
56
70
  service: 'sts',
57
71
  customCredentials: null,
58
72
  forcePathStyle: false,
73
+ requestHandler,
59
74
  });
60
75
  };
@@ -19,6 +19,7 @@ export type AwsProvider = {
19
19
  runtimePreference: RuntimePreference;
20
20
  };
21
21
  storageClass: StorageClass;
22
+ requestHandler: RequestHandler | null | undefined;
22
23
  };
23
24
 
24
25
  import type {StorageClass} from '@aws-sdk/client-s3';
@@ -49,6 +50,7 @@ import {parseFunctionName} from './parse-function-name';
49
50
  import {randomHashImplementation} from './random-hash';
50
51
  import {lambdaReadFileImplementation} from './read-file';
51
52
  import type {RuntimePreference} from './runtime-preference';
53
+ import type {RequestHandler} from './types';
52
54
  import {lambdaWriteFileImplementation} from './write-file';
53
55
 
54
56
  if (
@@ -4,12 +4,19 @@ import type {AwsProvider} from './aws-provider';
4
4
  import {getS3Client} from './get-s3-client';
5
5
 
6
6
  export const bucketExistsInRegionImplementation: ProviderSpecifics<AwsProvider>['bucketExists'] =
7
- async ({bucketName, region, expectedBucketOwner, forcePathStyle}) => {
7
+ async ({
8
+ bucketName,
9
+ region,
10
+ expectedBucketOwner,
11
+ forcePathStyle,
12
+ requestHandler,
13
+ }) => {
8
14
  try {
9
15
  const bucket = await getS3Client({
10
16
  region,
11
17
  customCredentials: null,
12
18
  forcePathStyle,
19
+ requestHandler,
13
20
  }).send(
14
21
  new GetBucketLocationCommand({
15
22
  Bucket: bucketName,
@@ -23,7 +23,11 @@ export const callFunctionAsyncImplementation = async <
23
23
  );
24
24
  }
25
25
 
26
- const result = await getLambdaClient(region as AwsRegion, timeoutInTest).send(
26
+ const result = await getLambdaClient(
27
+ region as AwsRegion,
28
+ timeoutInTest,
29
+ null,
30
+ ).send(
27
31
  new InvokeCommand({
28
32
  FunctionName: functionName,
29
33
  Payload: stringifiedPayload,
@@ -45,7 +45,11 @@ const invokeStreamOrTimeout = async <Provider extends CloudProvider>({
45
45
  type: string;
46
46
  payload: Record<string, unknown>;
47
47
  }) => {
48
- const resProm = getLambdaClient(region as AwsRegion, timeoutInTest).send(
48
+ const resProm = getLambdaClient(
49
+ region as AwsRegion,
50
+ timeoutInTest,
51
+ null,
52
+ ).send(
49
53
  new InvokeWithResponseStreamCommand({
50
54
  FunctionName: functionName,
51
55
  Payload: JSON.stringify({type, ...payload}),
@@ -21,7 +21,11 @@ const callLambdaSyncWithoutRetry = async <
21
21
  OrError<ServerlessReturnValues<Provider>[T]>
22
22
  > => {
23
23
  const Payload = JSON.stringify(payload);
24
- const res = await getLambdaClient(region as AwsRegion, timeoutInTest).send(
24
+ const res = await getLambdaClient(
25
+ region as AwsRegion,
26
+ timeoutInTest,
27
+ null,
28
+ ).send(
25
29
  new InvokeCommand({
26
30
  FunctionName: functionName,
27
31
  Payload,
@@ -14,6 +14,7 @@ export const cleanItems = <Provider extends CloudProvider>({
14
14
  list,
15
15
  providerSpecifics,
16
16
  forcePathStyle,
17
+ requestHandler,
17
18
  }: {
18
19
  bucket: string;
19
20
  region: Provider['region'];
@@ -22,6 +23,7 @@ export const cleanItems = <Provider extends CloudProvider>({
22
23
  onAfterItemDeleted: (data: {bucketName: string; itemName: string}) => void;
23
24
  providerSpecifics: ProviderSpecifics<Provider>;
24
25
  forcePathStyle: boolean;
26
+ requestHandler: Provider['requestHandler'] | null;
25
27
  }) => {
26
28
  return Promise.all(
27
29
  list.map((object) =>
@@ -36,6 +38,7 @@ export const cleanItems = <Provider extends CloudProvider>({
36
38
  region,
37
39
  customCredentials: null,
38
40
  forcePathStyle,
41
+ requestHandler,
39
42
  });
40
43
  onAfterItemDeleted({
41
44
  bucketName: bucket,
@@ -9,15 +9,25 @@ import type {AwsProvider} from './aws-provider';
9
9
  import {getS3Client} from './get-s3-client';
10
10
 
11
11
  export const createBucket: ProviderSpecifics<AwsProvider>['createBucket'] =
12
- async ({region, bucketName, forcePathStyle}) => {
13
- await getS3Client({region, customCredentials: null, forcePathStyle}).send(
12
+ async ({region, bucketName, forcePathStyle, requestHandler}) => {
13
+ await getS3Client({
14
+ region,
15
+ customCredentials: null,
16
+ forcePathStyle,
17
+ requestHandler,
18
+ }).send(
14
19
  new CreateBucketCommand({
15
20
  Bucket: bucketName,
16
21
  }),
17
22
  );
18
23
 
19
24
  try {
20
- await getS3Client({region, customCredentials: null, forcePathStyle}).send(
25
+ await getS3Client({
26
+ region,
27
+ customCredentials: null,
28
+ forcePathStyle,
29
+ requestHandler,
30
+ }).send(
21
31
  new DeleteBucketOwnershipControlsCommand({
22
32
  Bucket: bucketName,
23
33
  }),
@@ -33,7 +43,12 @@ export const createBucket: ProviderSpecifics<AwsProvider>['createBucket'] =
33
43
  }
34
44
 
35
45
  try {
36
- await getS3Client({region, customCredentials: null, forcePathStyle}).send(
46
+ await getS3Client({
47
+ region,
48
+ customCredentials: null,
49
+ forcePathStyle,
50
+ requestHandler,
51
+ }).send(
37
52
  new DeletePublicAccessBlockCommand({
38
53
  Bucket: bucketName,
39
54
  }),
@@ -49,7 +64,12 @@ export const createBucket: ProviderSpecifics<AwsProvider>['createBucket'] =
49
64
  }
50
65
 
51
66
  try {
52
- await getS3Client({region, customCredentials: null, forcePathStyle}).send(
67
+ await getS3Client({
68
+ region,
69
+ customCredentials: null,
70
+ forcePathStyle,
71
+ requestHandler,
72
+ }).send(
53
73
  new PutBucketAclCommand({
54
74
  Bucket: bucketName,
55
75
  ACL: 'public-read',
@@ -6,6 +6,7 @@ import type {
6
6
  import type {AwsProvider} from './aws-provider';
7
7
  import {getS3Client} from './get-s3-client';
8
8
  import type {AwsRegion} from './regions';
9
+ import type {RequestHandler} from './types';
9
10
 
10
11
  export const lambdaDeleteFileImplementation: ProviderSpecifics<AwsProvider>['deleteFile'] =
11
12
  async ({
@@ -14,14 +15,21 @@ export const lambdaDeleteFileImplementation: ProviderSpecifics<AwsProvider>['del
14
15
  region,
15
16
  customCredentials,
16
17
  forcePathStyle,
18
+ requestHandler,
17
19
  }: {
18
20
  region: AwsRegion;
19
21
  bucketName: string;
20
22
  key: string;
21
23
  customCredentials: CustomCredentials<AwsProvider> | null;
22
24
  forcePathStyle: boolean;
25
+ requestHandler: RequestHandler | null;
23
26
  }) => {
24
- await getS3Client({region, customCredentials, forcePathStyle}).send(
27
+ await getS3Client({
28
+ region,
29
+ customCredentials,
30
+ forcePathStyle,
31
+ requestHandler,
32
+ }).send(
25
33
  new DeleteObjectCommand({
26
34
  Bucket: bucketName,
27
35
  Key: key,
@@ -5,8 +5,11 @@ import type {
5
5
  } from '@remotion/serverless-client';
6
6
  import {getLambdaClient} from './aws-clients';
7
7
  import type {AwsProvider} from './aws-provider';
8
+ import type {RequestHandler} from './types';
8
9
 
9
- export type DeleteFunctionInput = GenericDeleteFunctionInput<AwsProvider>;
10
+ export type DeleteFunctionInput = GenericDeleteFunctionInput<AwsProvider> & {
11
+ requestHandler?: RequestHandler;
12
+ };
10
13
 
11
14
  /*
12
15
  * @description Deletes a deployed Lambda function based on its name.
@@ -15,8 +18,9 @@ export type DeleteFunctionInput = GenericDeleteFunctionInput<AwsProvider>;
15
18
  export const deleteFunction: DeleteFunction<AwsProvider> = async ({
16
19
  region,
17
20
  functionName,
21
+ requestHandler,
18
22
  }: DeleteFunctionInput): Promise<void> => {
19
- await getLambdaClient(region).send(
23
+ await getLambdaClient(region, undefined, requestHandler ?? null).send(
20
24
  new DeleteFunctionCommand({
21
25
  FunctionName: functionName,
22
26
  }),