@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
@@ -10,6 +10,7 @@ import {awsImplementation} from './aws-provider';
10
10
  import {cleanItems} from './clean-items';
11
11
  import {REMOTION_BUCKET_PREFIX} from './constants';
12
12
  import type {AwsRegion} from './regions';
13
+ import type {RequestHandler} from './types';
13
14
 
14
15
  export type DeleteRenderInput = {
15
16
  region: AwsRegion;
@@ -17,6 +18,7 @@ export type DeleteRenderInput = {
17
18
  renderId: string;
18
19
  customCredentials?: CustomCredentials<AwsProvider>;
19
20
  forcePathStyle?: boolean;
21
+ requestHandler?: RequestHandler;
20
22
  };
21
23
 
22
24
  export const internalDeleteRender = async (
@@ -35,6 +37,7 @@ export const internalDeleteRender = async (
35
37
  renderId: input.renderId,
36
38
  providerSpecifics: input.providerSpecifics,
37
39
  forcePathStyle: input.forcePathStyle,
40
+ requestHandler: input.requestHandler,
38
41
  });
39
42
 
40
43
  // Render did not start yet
@@ -55,6 +58,7 @@ export const internalDeleteRender = async (
55
58
  key,
56
59
  region: input.region,
57
60
  forcePathStyle: input.forcePathStyle,
61
+ requestHandler: input.requestHandler,
58
62
  });
59
63
 
60
64
  let files = await input.providerSpecifics.listObjects({
@@ -63,6 +67,7 @@ export const internalDeleteRender = async (
63
67
  region: input.region,
64
68
  expectedBucketOwner,
65
69
  forcePathStyle: input.forcePathStyle,
70
+ requestHandler: input.requestHandler,
66
71
  });
67
72
 
68
73
  let totalSize = 0;
@@ -79,6 +84,7 @@ export const internalDeleteRender = async (
79
84
  region: input.region,
80
85
  providerSpecifics: input.providerSpecifics,
81
86
  forcePathStyle: input.forcePathStyle,
87
+ requestHandler: input.requestHandler,
82
88
  });
83
89
  files = await input.providerSpecifics.listObjects({
84
90
  bucketName: input.bucketName,
@@ -86,6 +92,7 @@ export const internalDeleteRender = async (
86
92
  region: input.region,
87
93
  expectedBucketOwner,
88
94
  forcePathStyle: input.forcePathStyle,
95
+ requestHandler: input.requestHandler,
89
96
  });
90
97
  }
91
98
 
@@ -102,6 +109,6 @@ export const deleteRender = (input: DeleteRenderInput) => {
102
109
  return internalDeleteRender({
103
110
  ...input,
104
111
  providerSpecifics: awsImplementation,
105
- forcePathStyle: false,
112
+ forcePathStyle: input.forcePathStyle ?? false,
106
113
  });
107
114
  };
@@ -10,7 +10,7 @@ export const getAccountIdImplementation: GetAccountId<
10
10
  > = async (options: {region: AwsRegion}) => {
11
11
  validateAwsRegion(options.region);
12
12
 
13
- const callerIdentity = await getStsClient(options.region).send(
13
+ const callerIdentity = await getStsClient(options.region, null).send(
14
14
  new GetCallerIdentityCommand({}),
15
15
  );
16
16
 
@@ -8,12 +8,14 @@ import type {CustomCredentials} from '@remotion/serverless-client';
8
8
  import type {AwsProvider} from './aws-provider';
9
9
  import {getServiceClient, type ServiceMapping} from './get-service-client';
10
10
  import type {AwsRegion} from './regions';
11
+ import type {RequestHandler} from './types';
11
12
 
12
13
  export type GetAwsClientInput<T extends keyof ServiceMapping> = {
13
14
  region: AwsRegion;
14
15
  service: T;
15
16
  customCredentials?: CustomCredentials<AwsProvider> | null;
16
17
  forcePathStyle?: boolean;
18
+ requestHandler?: RequestHandler;
17
19
  };
18
20
 
19
21
  type SdkMapping = {
@@ -39,6 +41,7 @@ export const getAwsClient = <T extends keyof ServiceMapping>({
39
41
  service,
40
42
  customCredentials,
41
43
  forcePathStyle,
44
+ requestHandler,
42
45
  }: GetAwsClientInput<T>): GetAwsClientOutput<T> => {
43
46
  return {
44
47
  client: getServiceClient({
@@ -46,6 +49,7 @@ export const getAwsClient = <T extends keyof ServiceMapping>({
46
49
  service,
47
50
  customCredentials: customCredentials ?? null,
48
51
  forcePathStyle: forcePathStyle ?? false,
52
+ requestHandler,
49
53
  }),
50
54
  sdk: {
51
55
  lambda: LambdaSDK,
@@ -17,11 +17,13 @@ export const getRemotionBuckets: ProviderSpecifics<AwsProvider>['getBuckets'] =
17
17
  region,
18
18
  forceBucketName,
19
19
  forcePathStyle,
20
+ requestHandler,
20
21
  }): Promise<BucketWithLocation[]> => {
21
22
  const {Buckets} = await getS3Client({
22
23
  region,
23
24
  customCredentials: null,
24
25
  forcePathStyle,
26
+ requestHandler,
25
27
  }).send(new ListBucketsCommand({}));
26
28
  if (!Buckets) {
27
29
  return [];
@@ -47,6 +49,7 @@ export const getRemotionBuckets: ProviderSpecifics<AwsProvider>['getBuckets'] =
47
49
  region,
48
50
  customCredentials: null,
49
51
  forcePathStyle,
52
+ requestHandler,
50
53
  }).send(
51
54
  new GetBucketLocationCommand({
52
55
  Bucket: bucket.Name as string,
@@ -13,6 +13,7 @@ import {
13
13
  } from '@remotion/serverless-client';
14
14
  import {awsImplementation} from './aws-provider';
15
15
  import type {AwsRegion} from './regions';
16
+ import type {RequestHandler} from './types';
16
17
 
17
18
  export type GetCompositionsOnLambdaInput = {
18
19
  chromiumOptions?: ChromiumOptions;
@@ -27,6 +28,7 @@ export type GetCompositionsOnLambdaInput = {
27
28
  */
28
29
  dumpBrowserLogs?: boolean;
29
30
  forcePathStyle?: boolean;
31
+ requestHandler?: RequestHandler | null;
30
32
  } & Partial<
31
33
  ToOptions<typeof BrowserSafeApis.optionsMap.getCompositionsOnLambda>
32
34
  >;
@@ -50,6 +52,7 @@ export const getCompositionsOnLambda = async ({
50
52
  dumpBrowserLogs,
51
53
  offthreadVideoCacheSizeInBytes,
52
54
  forcePathStyle,
55
+ requestHandler,
53
56
  }: GetCompositionsOnLambdaInput): Promise<GetCompositionsOnLambdaOutput> => {
54
57
  const stringifiedInputProps = serializeOrThrow(inputProps, 'input-props');
55
58
 
@@ -69,6 +72,7 @@ export const getCompositionsOnLambda = async ({
69
72
  providerSpecifics: awsImplementation,
70
73
  forcePathStyle: forcePathStyle ?? false,
71
74
  skipPutAcl: false,
75
+ requestHandler,
72
76
  });
73
77
 
74
78
  try {
@@ -90,6 +94,7 @@ export const getCompositionsOnLambda = async ({
90
94
  },
91
95
  region,
92
96
  timeoutInTest: 120000,
97
+ requestHandler,
93
98
  });
94
99
  return res.compositions;
95
100
  } catch (err) {
@@ -5,17 +5,22 @@ import {
5
5
  } from '@remotion/serverless-client';
6
6
  import {awsImplementation} from './aws-provider';
7
7
  import type {AwsRegion} from './regions';
8
+ import type {RequestHandler} from './types';
8
9
 
9
10
  export const getFunctionVersion = async ({
10
11
  functionName,
11
12
  region,
12
13
  logLevel,
14
+ requestHandler,
13
15
  }: {
14
16
  functionName: string;
15
17
  region: AwsRegion;
16
18
  logLevel: LogLevel;
19
+ requestHandler: RequestHandler | null | undefined;
17
20
  }): Promise<string> => {
18
21
  try {
22
+ // For now, we'll pass requestHandler to the awsImplementation if needed
23
+ // This might require deeper changes in the serverless-client framework
19
24
  const result = await awsImplementation.callFunctionSync({
20
25
  functionName,
21
26
  payload: {
@@ -25,6 +30,7 @@ export const getFunctionVersion = async ({
25
30
  region,
26
31
  type: ServerlessRoutines.info,
27
32
  timeoutInTest: 120000,
33
+ requestHandler,
28
34
  });
29
35
  return result.version;
30
36
  } catch (err) {
@@ -6,24 +6,32 @@ import {getLambdaClient} from './aws-clients';
6
6
  import {DEFAULT_EPHEMERAL_STORAGE_IN_MB, RENDER_FN_PREFIX} from './constants';
7
7
  import {getFunctionVersion} from './get-function-version';
8
8
  import type {AwsRegion} from './regions';
9
+ import type {RequestHandler} from './types';
9
10
 
10
11
  export type GetFunctionsInput = {
11
12
  region: AwsRegion;
12
13
  compatibleOnly: boolean;
13
14
  logLevel?: LogLevel;
15
+ requestHandler?: RequestHandler;
14
16
  };
15
17
 
16
18
  const getAllFunctions = async ({
17
19
  existing,
18
20
  nextMarker,
19
21
  region,
22
+ requestHandler,
20
23
  }: {
21
24
  existing: FunctionConfiguration[];
22
25
  nextMarker: string | null;
23
26
  region: AwsRegion;
27
+ requestHandler?: RequestHandler;
24
28
  }): Promise<FunctionConfiguration[]> => {
25
29
  const allLambdas: FunctionConfiguration[] = [...existing];
26
- const lambdas = await getLambdaClient(region).send(
30
+ const lambdas = await getLambdaClient(
31
+ region,
32
+ undefined,
33
+ requestHandler ?? null,
34
+ ).send(
27
35
  new ListFunctionsCommand({
28
36
  Marker: nextMarker ?? undefined,
29
37
  }),
@@ -41,6 +49,7 @@ const getAllFunctions = async ({
41
49
  existing: allLambdas,
42
50
  nextMarker: lambdas.NextMarker,
43
51
  region,
52
+ requestHandler,
44
53
  });
45
54
  }
46
55
 
@@ -58,6 +67,7 @@ export const getFunctions = async (
58
67
  existing: [],
59
68
  nextMarker: null,
60
69
  region: params.region,
70
+ requestHandler: params.requestHandler,
61
71
  });
62
72
 
63
73
  const remotionLambdas = lambdas.filter((f) => {
@@ -71,6 +81,7 @@ export const getFunctions = async (
71
81
  functionName: fn.FunctionName as string,
72
82
  region: params.region,
73
83
  logLevel: params.logLevel ?? 'info',
84
+ requestHandler: params.requestHandler,
74
85
  });
75
86
  return version;
76
87
  } catch {
@@ -5,6 +5,7 @@ import type {RenderProgress} from './constants';
5
5
  import {getRenderProgressPayload} from './make-lambda-payload';
6
6
  import {parseFunctionName} from './parse-function-name';
7
7
  import type {AwsRegion} from './regions';
8
+ import type {RequestHandler} from './types';
8
9
 
9
10
  export type GetRenderProgressInput = {
10
11
  functionName: string;
@@ -15,6 +16,7 @@ export type GetRenderProgressInput = {
15
16
  s3OutputProvider?: CustomCredentials<AwsProvider>;
16
17
  forcePathStyle?: boolean;
17
18
  skipLambdaInvocation?: boolean;
19
+ requestHandler?: RequestHandler;
18
20
  };
19
21
 
20
22
  /*
@@ -47,6 +49,7 @@ export const getRenderProgress = async (
47
49
  memorySizeInMb: parsed.memorySizeInMb,
48
50
  timeoutInMilliseconds: parsed.timeoutInSeconds * 1000,
49
51
  functionName: input.functionName,
52
+ requestHandler: input.requestHandler,
50
53
  });
51
54
  }
52
55
 
@@ -57,6 +60,7 @@ export const getRenderProgress = async (
57
60
  payload: getRenderProgressPayload(input),
58
61
  region: input.region,
59
62
  timeoutInTest: 120000,
63
+ requestHandler: input.requestHandler,
60
64
  });
61
65
  return result;
62
66
  };
@@ -3,20 +3,24 @@ import type {CustomCredentials} from '@remotion/serverless-client';
3
3
  import type {AwsProvider} from './aws-provider';
4
4
  import {getServiceClient} from './get-service-client';
5
5
  import type {AwsRegion} from './regions';
6
+ import type {RequestHandler} from './types';
6
7
 
7
8
  export const getS3Client = ({
8
9
  region,
9
10
  customCredentials,
10
11
  forcePathStyle,
12
+ requestHandler,
11
13
  }: {
12
14
  region: AwsRegion;
13
15
  customCredentials: CustomCredentials<AwsProvider> | null;
14
16
  forcePathStyle: boolean;
17
+ requestHandler: RequestHandler | null;
15
18
  }): S3Client => {
16
19
  return getServiceClient({
17
20
  region: customCredentials?.region ?? region,
18
21
  service: 's3',
19
22
  customCredentials,
20
23
  forcePathStyle,
24
+ requestHandler,
21
25
  });
22
26
  };
@@ -11,6 +11,7 @@ import {checkCredentials} from './check-credentials';
11
11
  import {getCredentials} from './get-credentials';
12
12
  import {getEnvVariable} from './get-env-variable';
13
13
  import type {AwsRegion} from './regions';
14
+ import type {RequestHandler} from './types';
14
15
 
15
16
  export type ServiceMapping = {
16
17
  s3: S3Client;
@@ -26,11 +27,13 @@ const getCredentialsHash = ({
26
27
  region,
27
28
  service,
28
29
  forcePathStyle,
30
+ requestHandler,
29
31
  }: {
30
32
  region: AwsRegion;
31
33
  customCredentials: CustomCredentials<AwsProvider> | null;
32
34
  service: keyof ServiceMapping;
33
35
  forcePathStyle: boolean;
36
+ requestHandler: RequestHandler | null;
34
37
  }): string => {
35
38
  const hashComponents: {[key: string]: unknown} = {};
36
39
 
@@ -68,6 +71,7 @@ const getCredentialsHash = ({
68
71
  hashComponents.region = region;
69
72
  hashComponents.service = service;
70
73
  hashComponents.forcePathStyle = forcePathStyle;
74
+ hashComponents.requestHandler = requestHandler;
71
75
 
72
76
  return random(JSON.stringify(hashComponents)).toString().replace('0.', '');
73
77
  };
@@ -89,11 +93,13 @@ export const getServiceClient = <T extends keyof ServiceMapping>({
89
93
  service,
90
94
  customCredentials,
91
95
  forcePathStyle,
96
+ requestHandler,
92
97
  }: {
93
98
  region: AwsRegion;
94
99
  service: T;
95
100
  customCredentials: CustomCredentials<AwsProvider> | null;
96
101
  forcePathStyle: boolean;
102
+ requestHandler: RequestHandler | null;
97
103
  }): ServiceMapping[T] => {
98
104
  const Client = (() => {
99
105
  if (service === 'cloudwatch') {
@@ -128,6 +134,7 @@ export const getServiceClient = <T extends keyof ServiceMapping>({
128
134
  customCredentials,
129
135
  service,
130
136
  forcePathStyle,
137
+ requestHandler,
131
138
  });
132
139
 
133
140
  if (!_clients[key]) {
@@ -142,6 +149,13 @@ export const getServiceClient = <T extends keyof ServiceMapping>({
142
149
  }
143
150
  : undefined;
144
151
 
152
+ // Merge custom requestHandler with lambda options
153
+ const finalRequestHandler = requestHandler
154
+ ? lambdaOptions
155
+ ? {...requestHandler, ...lambdaOptions}
156
+ : requestHandler
157
+ : lambdaOptions;
158
+
145
159
  const client = customCredentials
146
160
  ? new Client({
147
161
  region: customCredentials.region ?? 'us-east-1',
@@ -153,20 +167,20 @@ export const getServiceClient = <T extends keyof ServiceMapping>({
153
167
  }
154
168
  : undefined,
155
169
  endpoint: customCredentials.endpoint,
156
- requestHandler: lambdaOptions,
170
+ requestHandler: finalRequestHandler,
157
171
  forcePathStyle: customCredentials.forcePathStyle,
158
172
  maxAttempts: service === 'lambda' ? 1 : undefined,
159
173
  })
160
174
  : getEnvVariable('REMOTION_SKIP_AWS_CREDENTIALS_CHECK')
161
175
  ? new Client({
162
176
  region,
163
- requestHandler: lambdaOptions,
177
+ requestHandler: finalRequestHandler,
164
178
  maxAttempts: service === 'lambda' ? 1 : undefined,
165
179
  })
166
180
  : new Client({
167
181
  region,
168
182
  credentials: getCredentials(),
169
- requestHandler: lambdaOptions,
183
+ requestHandler: finalRequestHandler,
170
184
  maxAttempts: service === 'lambda' ? 1 : undefined,
171
185
  });
172
186
 
package/src/get-sites.ts CHANGED
@@ -5,6 +5,7 @@ import {getSitesKey} from './constants';
5
5
  import type {BucketWithLocation} from './get-buckets';
6
6
  import {makeS3ServeUrl} from './make-s3-url';
7
7
  import type {AwsRegion} from './regions';
8
+ import type {RequestHandler} from './types';
8
9
 
9
10
  type Site = {
10
11
  sizeInBytes: number;
@@ -21,6 +22,7 @@ type MandatoryParameters = {
21
22
  type OptionalParameters = {
22
23
  forceBucketName: string | null;
23
24
  forcePathStyle: boolean;
25
+ requestHandler: RequestHandler | null;
24
26
  };
25
27
 
26
28
  type GetSitesInternalInput = MandatoryParameters & OptionalParameters;
@@ -36,6 +38,7 @@ export const internalGetSites = async ({
36
38
  forceBucketName,
37
39
  providerSpecifics,
38
40
  forcePathStyle,
41
+ requestHandler,
39
42
  }: GetSitesInternalInput & {
40
43
  providerSpecifics: ProviderSpecifics<AwsProvider>;
41
44
  }): Promise<GetSitesOutput> => {
@@ -44,11 +47,13 @@ export const internalGetSites = async ({
44
47
  region,
45
48
  forceBucketName,
46
49
  forcePathStyle,
50
+ requestHandler,
47
51
  })
48
52
  : await providerSpecifics.getBuckets({
49
53
  region,
50
54
  forceBucketName: null,
51
55
  forcePathStyle,
56
+ requestHandler,
52
57
  });
53
58
  const accountId = await providerSpecifics.getAccountId({region});
54
59
 
@@ -61,6 +66,7 @@ export const internalGetSites = async ({
61
66
  region,
62
67
  expectedBucketOwner: accountId,
63
68
  forcePathStyle,
69
+ requestHandler,
64
70
  });
65
71
 
66
72
  for (const file of ls) {
@@ -118,11 +124,13 @@ export const getSites = ({
118
124
  region,
119
125
  forceBucketName,
120
126
  forcePathStyle,
127
+ requestHandler,
121
128
  }: GetSitesInput): Promise<GetSitesOutput> => {
122
129
  return internalGetSites({
123
130
  region,
124
131
  forceBucketName: forceBucketName ?? null,
125
132
  forcePathStyle: forcePathStyle ?? false,
126
133
  providerSpecifics: awsImplementation,
134
+ requestHandler: requestHandler ?? null,
127
135
  });
128
136
  };
package/src/head-file.ts CHANGED
@@ -10,6 +10,7 @@ export const lambdaHeadFileImplementation: ProviderSpecifics<AwsProvider>['headF
10
10
  region,
11
11
  customCredentials,
12
12
  forcePathStyle,
13
+ requestHandler,
13
14
  }): Promise<{
14
15
  LastModified?: Date | undefined;
15
16
  ContentLength?: number | undefined;
@@ -18,6 +19,7 @@ export const lambdaHeadFileImplementation: ProviderSpecifics<AwsProvider>['headF
18
19
  region,
19
20
  customCredentials,
20
21
  forcePathStyle,
22
+ requestHandler,
21
23
  }).send(
22
24
  new HeadObjectCommand({
23
25
  Bucket: bucketName,
package/src/index.ts CHANGED
@@ -105,6 +105,7 @@ export {
105
105
  speculateFunctionName,
106
106
  type SpeculateFunctionNameInput,
107
107
  } from './speculate-function-name';
108
+ export type {RequestHandler} from './types';
108
109
  export {validateWebhookSignature} from './validate-webhook-signature';
109
110
 
110
111
  export const LambdaClientInternals = {
@@ -34,7 +34,10 @@ export const isFlakyError = (err: Error): boolean => {
34
34
  return true;
35
35
  }
36
36
 
37
- if (message.includes('Timed out while setting up the headless browser')) {
37
+ if (
38
+ message.includes('Timed out') &&
39
+ message.includes('while setting up the headless browser')
40
+ ) {
38
41
  return true;
39
42
  }
40
43
 
@@ -8,17 +8,20 @@ import type {AwsProvider} from './aws-provider';
8
8
  import {getS3Client} from './get-s3-client';
9
9
  import {getLifeCycleRules} from './lifecycle';
10
10
  import type {AwsRegion} from './regions';
11
+ import type {RequestHandler} from './types';
11
12
 
12
13
  const createLCRules = async ({
13
14
  bucketName,
14
15
  region,
15
16
  customCredentials,
16
17
  forcePathStyle,
18
+ requestHandler,
17
19
  }: {
18
20
  bucketName: string;
19
21
  region: AwsRegion;
20
22
  customCredentials: CustomCredentials<AwsProvider> | null;
21
23
  forcePathStyle: boolean;
24
+ requestHandler: RequestHandler | null;
22
25
  }) => {
23
26
  const lcRules = getLifeCycleRules();
24
27
  // create the lifecyle rules
@@ -30,9 +33,12 @@ const createLCRules = async ({
30
33
  createCommandInput,
31
34
  );
32
35
  try {
33
- await getS3Client({region, customCredentials, forcePathStyle}).send(
34
- createCommand,
35
- );
36
+ await getS3Client({
37
+ region,
38
+ customCredentials,
39
+ forcePathStyle,
40
+ requestHandler,
41
+ }).send(createCommand);
36
42
  } catch (err) {
37
43
  if ((err as Error).stack?.includes('AccessDenied')) {
38
44
  throw new Error(
@@ -47,19 +53,24 @@ const deleteLCRules = async ({
47
53
  region,
48
54
  customCredentials,
49
55
  forcePathStyle,
56
+ requestHandler,
50
57
  }: {
51
58
  bucketName: string;
52
59
  region: AwsRegion;
53
60
  customCredentials: CustomCredentials<AwsProvider> | null;
54
61
  forcePathStyle: boolean;
62
+ requestHandler: RequestHandler | null;
55
63
  }) => {
56
64
  const deleteCommandInput = deleteLifeCycleInput({
57
65
  bucketName,
58
66
  });
59
67
  try {
60
- await getS3Client({region, customCredentials, forcePathStyle}).send(
61
- new DeleteBucketLifecycleCommand(deleteCommandInput),
62
- );
68
+ await getS3Client({
69
+ region,
70
+ customCredentials,
71
+ forcePathStyle,
72
+ requestHandler,
73
+ }).send(new DeleteBucketLifecycleCommand(deleteCommandInput));
63
74
  } catch (err) {
64
75
  if ((err as Error).stack?.includes('AccessDenied')) {
65
76
  throw new Error(
@@ -75,12 +86,14 @@ export const applyLifeCyleOperation = async ({
75
86
  region,
76
87
  customCredentials,
77
88
  forcePathStyle,
89
+ requestHandler,
78
90
  }: {
79
91
  enableFolderExpiry: boolean | null;
80
92
  bucketName: string;
81
93
  region: AwsRegion;
82
94
  customCredentials: CustomCredentials<AwsProvider> | null;
83
95
  forcePathStyle: boolean;
96
+ requestHandler: RequestHandler | null;
84
97
  }) => {
85
98
  if (enableFolderExpiry === null) {
86
99
  return;
@@ -92,6 +105,7 @@ export const applyLifeCyleOperation = async ({
92
105
  region,
93
106
  customCredentials,
94
107
  forcePathStyle,
108
+ requestHandler,
95
109
  });
96
110
  } else {
97
111
  await deleteLCRules({
@@ -99,6 +113,7 @@ export const applyLifeCyleOperation = async ({
99
113
  region,
100
114
  customCredentials,
101
115
  forcePathStyle,
116
+ requestHandler,
102
117
  });
103
118
  }
104
119
  };
@@ -11,12 +11,14 @@ export const lambdaLsImplementation: ProviderSpecifics<AwsProvider>['listObjects
11
11
  expectedBucketOwner,
12
12
  continuationToken,
13
13
  forcePathStyle,
14
+ requestHandler,
14
15
  }) => {
15
16
  try {
16
17
  const list = await getS3Client({
17
18
  region,
18
19
  customCredentials: null,
19
20
  forcePathStyle,
21
+ requestHandler,
20
22
  }).send(
21
23
  new ListObjectsV2Command({
22
24
  Bucket: bucketName,
@@ -42,6 +44,7 @@ export const lambdaLsImplementation: ProviderSpecifics<AwsProvider>['listObjects
42
44
  region,
43
45
  continuationToken: list.NextContinuationToken,
44
46
  forcePathStyle,
47
+ requestHandler,
45
48
  })),
46
49
  ];
47
50
  }
@@ -67,6 +70,7 @@ export const lambdaLsImplementation: ProviderSpecifics<AwsProvider>['listObjects
67
70
  region,
68
71
  customCredentials: null,
69
72
  forcePathStyle,
73
+ requestHandler,
70
74
  }).send(
71
75
  new ListObjectsV2Command({
72
76
  Bucket: bucketName,
@@ -38,6 +38,7 @@ import {validateWebhook} from '@remotion/serverless-client';
38
38
  import type {GetRenderProgressInput} from './get-render-progress';
39
39
  import type {AwsRegion} from './regions';
40
40
  import type {RenderStillOnLambdaNonNullInput} from './render-still-on-lambda';
41
+ import type {RequestHandler} from './types';
41
42
  import {validateLambdaCodec} from './validate-lambda-codec';
42
43
  import {validateServeUrl} from './validate-serveurl';
43
44
 
@@ -86,6 +87,7 @@ export type InnerRenderMediaOnLambdaInput = {
86
87
  forcePathStyle: boolean;
87
88
  metadata: Record<string, string> | null;
88
89
  storageClass: StorageClass | null;
90
+ requestHandler: RequestHandler | null;
89
91
  } & ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>;
90
92
 
91
93
  export const makeLambdaRenderMediaPayload = async ({
@@ -135,6 +137,7 @@ export const makeLambdaRenderMediaPayload = async ({
135
137
  apiKey,
136
138
  offthreadVideoThreads,
137
139
  storageClass,
140
+ requestHandler,
138
141
  }: InnerRenderMediaOnLambdaInput): Promise<
139
142
  ServerlessStartPayload<AwsProvider>
140
143
  > => {
@@ -168,6 +171,7 @@ export const makeLambdaRenderMediaPayload = async ({
168
171
  providerSpecifics: awsImplementation,
169
172
  forcePathStyle: forcePathStyle ?? false,
170
173
  skipPutAcl: privacy === 'no-acl',
174
+ requestHandler: requestHandler ?? null,
171
175
  });
172
176
  return {
173
177
  rendererFunctionName,
@@ -263,6 +267,7 @@ export const makeLambdaRenderStillPayload = async ({
263
267
  forcePathStyle,
264
268
  apiKey,
265
269
  storageClass,
270
+ requestHandler,
266
271
  }: RenderStillOnLambdaNonNullInput): Promise<
267
272
  ServerlessPayloads<AwsProvider>[ServerlessRoutines.still]
268
273
  > => {
@@ -284,6 +289,7 @@ export const makeLambdaRenderStillPayload = async ({
284
289
  providerSpecifics: awsImplementation,
285
290
  forcePathStyle,
286
291
  skipPutAcl: privacy === 'no-acl',
292
+ requestHandler,
287
293
  });
288
294
 
289
295
  return {