@remotion/lambda-client 4.0.387 → 4.0.388

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 (141) hide show
  1. package/dist/cjs/index.js +33 -33
  2. package/dist/esm/index.mjs +20 -20
  3. package/package.json +3 -3
  4. package/dist/app-router-webhook.d.ts +0 -10
  5. package/dist/app-router-webhook.js +0 -43
  6. package/dist/apply-lifecycle.d.ts +0 -8
  7. package/dist/apply-lifecycle.js +0 -18
  8. package/dist/aws-clients.d.ts +0 -12
  9. package/dist/aws-clients.js +0 -56
  10. package/dist/aws-provider.d.ts +0 -27
  11. package/dist/aws-provider.js +0 -94
  12. package/dist/bucket-exists.d.ts +0 -3
  13. package/dist/bucket-exists.js +0 -27
  14. package/dist/call-lambda-async.d.ts +0 -2
  15. package/dist/call-lambda-async.js +0 -20
  16. package/dist/call-lambda-streaming.d.ts +0 -6
  17. package/dist/call-lambda-streaming.js +0 -126
  18. package/dist/call-lambda-sync.d.ts +0 -2
  19. package/dist/call-lambda-sync.js +0 -30
  20. package/dist/check-credentials.d.ts +0 -1
  21. package/dist/check-credentials.js +0 -39
  22. package/dist/clean-items.d.ts +0 -17
  23. package/dist/clean-items.js +0 -26
  24. package/dist/constants.d.ts +0 -25
  25. package/dist/constants.js +0 -26
  26. package/dist/content-disposition-header.d.ts +0 -2
  27. package/dist/content-disposition-header.js +0 -50
  28. package/dist/convert-to-serve-url.d.ts +0 -6
  29. package/dist/convert-to-serve-url.js +0 -14
  30. package/dist/create-bucket.d.ts +0 -3
  31. package/dist/create-bucket.js +0 -65
  32. package/dist/delete-file.d.ts +0 -3
  33. package/dist/delete-file.js +0 -17
  34. package/dist/delete-function.d.ts +0 -7
  35. package/dist/delete-function.js +0 -15
  36. package/dist/delete-render.d.ts +0 -22
  37. package/dist/delete-render.js +0 -90
  38. package/dist/encode-aws-url-params.d.ts +0 -1
  39. package/dist/encode-aws-url-params.js +0 -7
  40. package/dist/estimate-price.d.ts +0 -17
  41. package/dist/estimate-price.js +0 -45
  42. package/dist/express-webhook.d.ts +0 -3
  43. package/dist/express-webhook.js +0 -46
  44. package/dist/get-account-id.d.ts +0 -3
  45. package/dist/get-account-id.js +0 -15
  46. package/dist/get-aws-client.d.ts +0 -32
  47. package/dist/get-aws-client.js +0 -67
  48. package/dist/get-aws-urls.d.ts +0 -25
  49. package/dist/get-aws-urls.js +0 -31
  50. package/dist/get-buckets.d.ts +0 -9
  51. package/dist/get-buckets.js +0 -64
  52. package/dist/get-compositions-on-lambda.d.ts +0 -20
  53. package/dist/get-compositions-on-lambda.js +0 -62
  54. package/dist/get-credentials.d.ts +0 -9
  55. package/dist/get-credentials.js +0 -55
  56. package/dist/get-env-variable.d.ts +0 -1
  57. package/dist/get-env-variable.js +0 -15
  58. package/dist/get-function-name.d.ts +0 -8
  59. package/dist/get-function-name.js +0 -17
  60. package/dist/get-function-version.d.ts +0 -9
  61. package/dist/get-function-version.js +0 -35
  62. package/dist/get-functions.d.ts +0 -10
  63. package/dist/get-functions.js +0 -80
  64. package/dist/get-output-url-from-metadata.d.ts +0 -3
  65. package/dist/get-output-url-from-metadata.js +0 -18
  66. package/dist/get-render-progress.d.ts +0 -17
  67. package/dist/get-render-progress.js +0 -47
  68. package/dist/get-s3-client.d.ts +0 -11
  69. package/dist/get-s3-client.js +0 -15
  70. package/dist/get-service-client.d.ts +0 -25
  71. package/dist/get-service-client.js +0 -131
  72. package/dist/get-sites.d.ts +0 -31
  73. package/dist/get-sites.js +0 -83
  74. package/dist/head-file.d.ts +0 -3
  75. package/dist/head-file.js +0 -18
  76. package/dist/index.d.ts +0 -129
  77. package/dist/index.js +0 -108
  78. package/dist/is-cli.d.ts +0 -2
  79. package/dist/is-cli.js +0 -10
  80. package/dist/is-flaky-error.d.ts +0 -1
  81. package/dist/is-flaky-error.js +0 -78
  82. package/dist/is-in-lambda.d.ts +0 -1
  83. package/dist/is-in-lambda.js +0 -9
  84. package/dist/is-likely-to-have-aws-profile.d.ts +0 -1
  85. package/dist/is-likely-to-have-aws-profile.js +0 -50
  86. package/dist/lambda-version-string.d.ts +0 -1
  87. package/dist/lambda-version-string.js +0 -7
  88. package/dist/lifecycle-rules.d.ts +0 -12
  89. package/dist/lifecycle-rules.js +0 -73
  90. package/dist/lifecycle.d.ts +0 -7
  91. package/dist/lifecycle.js +0 -24
  92. package/dist/list-objects.d.ts +0 -3
  93. package/dist/list-objects.js +0 -70
  94. package/dist/make-lambda-payload.d.ts +0 -59
  95. package/dist/make-lambda-payload.js +0 -150
  96. package/dist/make-s3-url.d.ts +0 -6
  97. package/dist/make-s3-url.js +0 -7
  98. package/dist/p-limit.d.ts +0 -1
  99. package/dist/p-limit.js +0 -57
  100. package/dist/pages-router-webhook.d.ts +0 -5
  101. package/dist/pages-router-webhook.js +0 -48
  102. package/dist/parse-function-name.d.ts +0 -8
  103. package/dist/parse-function-name.js +0 -17
  104. package/dist/presign-url.d.ts +0 -17
  105. package/dist/presign-url.js +0 -66
  106. package/dist/price-per-1s.d.ts +0 -37
  107. package/dist/price-per-1s.js +0 -822
  108. package/dist/random-hash.d.ts +0 -1
  109. package/dist/random-hash.js +0 -13
  110. package/dist/read-file.d.ts +0 -11
  111. package/dist/read-file.js +0 -19
  112. package/dist/regions.d.ts +0 -3
  113. package/dist/regions.js +0 -48
  114. package/dist/render-media-on-lambda.d.ts +0 -66
  115. package/dist/render-media-on-lambda.js +0 -133
  116. package/dist/render-still-on-lambda.d.ts +0 -61
  117. package/dist/render-still-on-lambda.js +0 -121
  118. package/dist/runtime-preference.d.ts +0 -2
  119. package/dist/runtime-preference.js +0 -8
  120. package/dist/speculate-function-name.d.ts +0 -7
  121. package/dist/speculate-function-name.js +0 -39
  122. package/dist/types.d.ts +0 -4
  123. package/dist/types.js +0 -2
  124. package/dist/validate-aws-region.d.ts +0 -2
  125. package/dist/validate-aws-region.js +0 -9
  126. package/dist/validate-bucketname.d.ts +0 -4
  127. package/dist/validate-bucketname.js +0 -15
  128. package/dist/validate-disk-size-in-mb.d.ts +0 -1
  129. package/dist/validate-disk-size-in-mb.js +0 -23
  130. package/dist/validate-lambda-codec.d.ts +0 -2
  131. package/dist/validate-lambda-codec.js +0 -21
  132. package/dist/validate-memory-size.d.ts +0 -1
  133. package/dist/validate-memory-size.js +0 -22
  134. package/dist/validate-presign-expiration.d.ts +0 -1
  135. package/dist/validate-presign-expiration.js +0 -29
  136. package/dist/validate-serveurl.d.ts +0 -1
  137. package/dist/validate-serveurl.js +0 -9
  138. package/dist/validate-webhook-signature.d.ts +0 -5
  139. package/dist/validate-webhook-signature.js +0 -28
  140. package/dist/write-file.d.ts +0 -5
  141. package/dist/write-file.js +0 -83
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bucketExistsInRegionImplementation = void 0;
4
- const client_s3_1 = require("@aws-sdk/client-s3");
5
- const get_s3_client_1 = require("./get-s3-client");
6
- const bucketExistsInRegionImplementation = async ({ bucketName, region, expectedBucketOwner, forcePathStyle, requestHandler, }) => {
7
- var _a;
8
- try {
9
- const bucket = await (0, get_s3_client_1.getS3Client)({
10
- region,
11
- customCredentials: null,
12
- forcePathStyle,
13
- requestHandler,
14
- }).send(new client_s3_1.GetBucketLocationCommand({
15
- Bucket: bucketName,
16
- ExpectedBucketOwner: expectedBucketOwner !== null && expectedBucketOwner !== void 0 ? expectedBucketOwner : undefined,
17
- }));
18
- return ((_a = bucket.LocationConstraint) !== null && _a !== void 0 ? _a : 'us-east-1') === region;
19
- }
20
- catch (err) {
21
- if (err.Code === 'NoSuchBucket') {
22
- return false;
23
- }
24
- throw err;
25
- }
26
- };
27
- exports.bucketExistsInRegionImplementation = bucketExistsInRegionImplementation;
@@ -1,2 +0,0 @@
1
- import type { CallFunctionOptions, CloudProvider, ServerlessRoutines } from '@remotion/serverless-client';
2
- export declare const callFunctionAsyncImplementation: <T extends ServerlessRoutines, Provider extends CloudProvider>({ functionName, payload, region, timeoutInTest, }: CallFunctionOptions<T, Provider>) => Promise<void>;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.callFunctionAsyncImplementation = void 0;
4
- const client_lambda_1 = require("@aws-sdk/client-lambda");
5
- const aws_clients_1 = require("./aws-clients");
6
- const callFunctionAsyncImplementation = async ({ functionName, payload, region, timeoutInTest, }) => {
7
- const stringifiedPayload = JSON.stringify(payload);
8
- if (stringifiedPayload.length > 256 * 1024) {
9
- throw new Error(`Payload is too big: ${stringifiedPayload.length} bytes. Maximum size is 256 KB. This should not happen, please report this to the Remotion team. Payload: ${stringifiedPayload}`);
10
- }
11
- const result = await (0, aws_clients_1.getLambdaClient)(region, timeoutInTest, null).send(new client_lambda_1.InvokeCommand({
12
- FunctionName: functionName,
13
- Payload: stringifiedPayload,
14
- InvocationType: 'Event',
15
- }));
16
- if (result.FunctionError) {
17
- throw new Error(`Lambda function returned error: ${result.FunctionError} ${result.LogResult}`);
18
- }
19
- };
20
- exports.callFunctionAsyncImplementation = callFunctionAsyncImplementation;
@@ -1,6 +0,0 @@
1
- import type { CallFunctionOptions, CloudProvider, OnMessage, ServerlessRoutines } from '@remotion/serverless-client';
2
- export declare const parseJsonOrThrowSource: (data: Uint8Array, type: string) => any;
3
- export declare const callFunctionWithStreamingImplementation: <Provider extends CloudProvider, T extends ServerlessRoutines>(options: CallFunctionOptions<T, Provider> & {
4
- receivedStreamingPayload: OnMessage<Provider>;
5
- retriesRemaining: number;
6
- }) => Promise<void>;
@@ -1,126 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.callFunctionWithStreamingImplementation = exports.parseJsonOrThrowSource = void 0;
4
- const client_lambda_1 = require("@aws-sdk/client-lambda");
5
- const serverless_client_1 = require("@remotion/serverless-client");
6
- const aws_clients_1 = require("./aws-clients");
7
- const STREAM_STALL_TIMEOUT = 30000;
8
- const LAMBDA_STREAM_STALL = `AWS did not invoke Lambda in ${STREAM_STALL_TIMEOUT}ms`;
9
- const parseJsonOrThrowSource = (data, type) => {
10
- const asString = new TextDecoder('utf-8').decode(data);
11
- try {
12
- return JSON.parse(asString);
13
- }
14
- catch (_a) {
15
- throw new Error(`Invalid JSON (${type}): ${asString}`);
16
- }
17
- };
18
- exports.parseJsonOrThrowSource = parseJsonOrThrowSource;
19
- const invokeStreamOrTimeout = async ({ region, timeoutInTest, functionName, type, payload, }) => {
20
- const resProm = (0, aws_clients_1.getLambdaClient)(region, timeoutInTest, null).send(new client_lambda_1.InvokeWithResponseStreamCommand({
21
- FunctionName: functionName,
22
- Payload: JSON.stringify({ type, ...payload }),
23
- }));
24
- let cleanup = () => undefined;
25
- const timeout = new Promise((_resolve, reject) => {
26
- const int = setTimeout(() => {
27
- reject(new Error(LAMBDA_STREAM_STALL));
28
- }, STREAM_STALL_TIMEOUT);
29
- cleanup = () => {
30
- clearTimeout(int);
31
- };
32
- });
33
- const res = await Promise.race([resProm, timeout]);
34
- cleanup();
35
- return res;
36
- };
37
- const INVALID_JSON_MESSAGE = 'Cannot parse Lambda response as JSON';
38
- const callLambdaWithStreamingWithoutRetry = async ({ functionName, type, payload, region, timeoutInTest, receivedStreamingPayload, }) => {
39
- const res = await invokeStreamOrTimeout({
40
- functionName,
41
- payload,
42
- region,
43
- timeoutInTest,
44
- type,
45
- });
46
- const { onData, clear } = (0, serverless_client_1.makeStreamer)((status, messageTypeId, data) => {
47
- const messageType = (0, serverless_client_1.messageTypeIdToMessageType)(messageTypeId);
48
- const innerPayload = serverless_client_1.formatMap[messageType] === 'json'
49
- ? (0, exports.parseJsonOrThrowSource)(data, messageType)
50
- : data;
51
- const message = {
52
- successType: status,
53
- message: {
54
- type: messageType,
55
- payload: innerPayload,
56
- },
57
- };
58
- receivedStreamingPayload(message);
59
- });
60
- const dumpBuffers = () => {
61
- clear();
62
- };
63
- // @ts-expect-error - We are adding a listener to a global variable
64
- if (globalThis._dumpUnreleasedBuffers) {
65
- // @ts-expect-error - We are adding a listener to a global variable
66
- globalThis._dumpUnreleasedBuffers.addListener('dump-unreleased-buffers', dumpBuffers);
67
- }
68
- const events = res.EventStream;
69
- for await (const event of events) {
70
- // There are two types of events you can get on a stream.
71
- // `PayloadChunk`: These contain the actual raw bytes of the chunk
72
- // It has a single property: `Payload`
73
- if (event.PayloadChunk && event.PayloadChunk.Payload) {
74
- onData(event.PayloadChunk.Payload);
75
- }
76
- if (event.InvokeComplete) {
77
- if (event.InvokeComplete.ErrorCode) {
78
- const logs = `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#logsV2:logs-insights$3FqueryDetail$3D~(end~0~start~-3600~timeType~'RELATIVE~unit~'seconds~editorString~'fields*20*40timestamp*2c*20*40requestId*2c*20*40message*0a*7c*20filter*20*40requestId*20like*20*${res.$metadata.requestId}*22*0a*7c*20sort*20*40timestamp*20asc~source~(~'*2faws*2flambda*2f${functionName}))`;
79
- if (event.InvokeComplete.ErrorCode === 'Unhandled') {
80
- throw new Error(`Lambda function ${functionName} failed with an unhandled error: ${event.InvokeComplete.ErrorDetails} See ${logs} to see the logs of this invocation.`);
81
- }
82
- throw new Error(`Lambda function ${functionName} failed with error code ${event.InvokeComplete.ErrorCode}: ${event.InvokeComplete.ErrorDetails}. See ${logs} to see the logs of this invocation.`);
83
- }
84
- }
85
- // Don't put a `break` statement here, as it will cause the socket to not properly exit.
86
- }
87
- // @ts-expect-error - We are adding a listener to a global variable
88
- if (globalThis._dumpUnreleasedBuffers) {
89
- // @ts-expect-error - We are adding a listener to a global variable
90
- globalThis._dumpUnreleasedBuffers.removeListener('dump-unreleased-buffers', dumpBuffers);
91
- }
92
- clear();
93
- };
94
- const callFunctionWithStreamingImplementation = async (options) => {
95
- // As of August 2023, Lambda streaming sometimes misses parts of the JSON response.
96
- // Handling this for now by applying a retry mechanism.
97
- var _a, _b;
98
- try {
99
- // Do not remove this await
100
- await callLambdaWithStreamingWithoutRetry(options);
101
- }
102
- catch (err) {
103
- if (((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('TooManyRequestsException')) ||
104
- ((_b = err.message) === null || _b === void 0 ? void 0 : _b.includes('ConcurrentInvocationLimitExceeded'))) {
105
- throw new Error(`AWS Concurrency limit reached (Original Error: ${err.message}). See https://www.remotion.dev/docs/lambda/troubleshooting/rate-limit for tips to fix this.`);
106
- }
107
- if (!err.message.includes(INVALID_JSON_MESSAGE) &&
108
- !err.message.includes(LAMBDA_STREAM_STALL) &&
109
- // https://discord.com/channels/809501355504959528/1332166561242288220/1332166561242288220
110
- !err.message.includes('Runtime.TruncatedResponse') &&
111
- !err.message.includes('aborted')) {
112
- throw err;
113
- }
114
- console.error('Retries remaining:', options.retriesRemaining);
115
- if (options.retriesRemaining === 0) {
116
- console.error('Throwing error:');
117
- throw err;
118
- }
119
- console.error(err);
120
- return (0, exports.callFunctionWithStreamingImplementation)({
121
- ...options,
122
- retriesRemaining: options.retriesRemaining - 1,
123
- });
124
- }
125
- };
126
- exports.callFunctionWithStreamingImplementation = callFunctionWithStreamingImplementation;
@@ -1,2 +0,0 @@
1
- import type { CallFunctionOptions, CloudProvider, ServerlessReturnValues, ServerlessRoutines } from '@remotion/serverless-client';
2
- export declare const callFunctionSyncImplementation: <Provider extends CloudProvider, T extends ServerlessRoutines>(options: CallFunctionOptions<T, Provider>) => Promise<ServerlessReturnValues<Provider>[T]>;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.callFunctionSyncImplementation = void 0;
4
- const client_lambda_1 = require("@aws-sdk/client-lambda");
5
- const aws_clients_1 = require("./aws-clients");
6
- const callLambdaSyncWithoutRetry = async ({ functionName, payload, region, timeoutInTest, }) => {
7
- const Payload = JSON.stringify(payload);
8
- const res = await (0, aws_clients_1.getLambdaClient)(region, timeoutInTest, null).send(new client_lambda_1.InvokeCommand({
9
- FunctionName: functionName,
10
- Payload,
11
- InvocationType: 'RequestResponse',
12
- }));
13
- const decoded = new TextDecoder('utf-8').decode(res.Payload);
14
- try {
15
- return JSON.parse(decoded);
16
- }
17
- catch (_a) {
18
- throw new Error(`Invalid JSON: ${JSON.stringify(decoded)}`);
19
- }
20
- };
21
- const callFunctionSyncImplementation = async (options) => {
22
- const res = await callLambdaSyncWithoutRetry(options);
23
- if (res.type === 'error') {
24
- const err = new Error(res.message);
25
- err.stack = res.stack;
26
- throw err;
27
- }
28
- return res;
29
- };
30
- exports.callFunctionSyncImplementation = callFunctionSyncImplementation;
@@ -1 +0,0 @@
1
- export declare const checkCredentials: () => void;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkCredentials = void 0;
4
- const serverless_client_1 = require("@remotion/serverless-client");
5
- const get_env_variable_1 = require("./get-env-variable");
6
- const is_cli_1 = require("./is-cli");
7
- const is_likely_to_have_aws_profile_1 = require("./is-likely-to-have-aws-profile");
8
- const messageForVariable = (variable) => {
9
- return [
10
- `You have tried to call a Remotion Lambda function, but have not set the environment variable ${variable}.`,
11
- (0, is_cli_1.getIsCli)()
12
- ? null
13
- : `- Environment variables from a '.env' file are not automatically read if you are calling the Node.JS APIs, in that case you need to load the file yourself or set the environment variables manually.`,
14
- `- Please refer to the Remotion Lambda docs (${serverless_client_1.DOCS_URL}/docs/lambda/setup) to see how to generate the credentials for your AWS account and then set the environment variables.`,
15
- `- For more reasons see the troubleshooting page: ${serverless_client_1.DOCS_URL}/docs/lambda/troubleshooting/permissions`,
16
- ]
17
- .filter(serverless_client_1.truthy)
18
- .join('\n');
19
- };
20
- const checkCredentials = () => {
21
- if ((0, get_env_variable_1.getEnvVariable)('REMOTION_SKIP_AWS_CREDENTIALS_CHECK')) {
22
- return;
23
- }
24
- if ((0, get_env_variable_1.getEnvVariable)('REMOTION_AWS_PROFILE') || (0, get_env_variable_1.getEnvVariable)('AWS_PROFILE')) {
25
- return;
26
- }
27
- if ((0, is_likely_to_have_aws_profile_1.isLikelyToHaveAwsProfile)()) {
28
- return;
29
- }
30
- if (!(0, get_env_variable_1.getEnvVariable)('AWS_ACCESS_KEY_ID') &&
31
- !(0, get_env_variable_1.getEnvVariable)('REMOTION_AWS_ACCESS_KEY_ID')) {
32
- throw new Error(messageForVariable('AWS_ACCESS_KEY_ID or REMOTION_AWS_ACCESS_KEY_ID'));
33
- }
34
- if (!(0, get_env_variable_1.getEnvVariable)('AWS_SECRET_ACCESS_KEY') &&
35
- !(0, get_env_variable_1.getEnvVariable)('REMOTION_AWS_SECRET_ACCESS_KEY')) {
36
- throw new Error(messageForVariable('AWS_SECRET_ACCESS_KEY or REMOTION_AWS_SECRET_ACCESS_KEY'));
37
- }
38
- };
39
- exports.checkCredentials = checkCredentials;
@@ -1,17 +0,0 @@
1
- import type { CloudProvider, ProviderSpecifics } from '@remotion/serverless-client';
2
- export declare const cleanItems: <Provider extends CloudProvider>({ bucket, onAfterItemDeleted, onBeforeItemDeleted, region, list, providerSpecifics, forcePathStyle, requestHandler, }: {
3
- bucket: string;
4
- region: Provider["region"];
5
- list: string[];
6
- onBeforeItemDeleted: (data: {
7
- bucketName: string;
8
- itemName: string;
9
- }) => void;
10
- onAfterItemDeleted: (data: {
11
- bucketName: string;
12
- itemName: string;
13
- }) => void;
14
- providerSpecifics: ProviderSpecifics<Provider>;
15
- forcePathStyle: boolean;
16
- requestHandler: Provider["requestHandler"] | null;
17
- }) => Promise<void[]>;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cleanItems = void 0;
4
- const p_limit_1 = require("./p-limit");
5
- const limit = (0, p_limit_1.pLimit)(10);
6
- const cleanItems = ({ bucket, onAfterItemDeleted, onBeforeItemDeleted, region, list, providerSpecifics, forcePathStyle, requestHandler, }) => {
7
- return Promise.all(list.map((object) => limit(async () => {
8
- onBeforeItemDeleted({
9
- bucketName: bucket,
10
- itemName: object,
11
- });
12
- await providerSpecifics.deleteFile({
13
- bucketName: bucket,
14
- key: object,
15
- region,
16
- customCredentials: null,
17
- forcePathStyle,
18
- requestHandler,
19
- });
20
- onAfterItemDeleted({
21
- bucketName: bucket,
22
- itemName: object,
23
- });
24
- })));
25
- };
26
- exports.cleanItems = cleanItems;
@@ -1,25 +0,0 @@
1
- import type { GenericRenderProgress, Privacy } from '@remotion/serverless-client';
2
- import type { AwsProvider } from './aws-provider';
3
- import type { AwsRegion } from './regions';
4
- export declare const MIN_MEMORY = 512;
5
- export declare const MAX_MEMORY = 10240;
6
- export declare const DEFAULT_MEMORY_SIZE = 2048;
7
- export declare const DEFAULT_TIMEOUT = 120;
8
- export declare const MIN_TIMEOUT = 15;
9
- export declare const MAX_TIMEOUT = 900;
10
- export declare const DEFAULT_FRAMES_PER_LAMBDA = 20;
11
- export declare const BINARY_NAME = "remotion lambda";
12
- export declare const DEFAULT_REGION: AwsRegion;
13
- export declare const DEFAULT_MAX_RETRIES = 1;
14
- export declare const MAX_EPHEMERAL_STORAGE_IN_MB = 10240;
15
- export declare const DEFAULT_EPHEMERAL_STORAGE_IN_MB = 2048;
16
- export declare const MIN_EPHEMERAL_STORAGE_IN_MB = 512;
17
- export declare const DEFAULT_OUTPUT_PRIVACY: Privacy;
18
- export declare const DEFAULT_CLOUDWATCH_RETENTION_PERIOD = 14;
19
- export declare const RENDER_FN_PREFIX = "remotion-render-";
20
- export declare const LOG_GROUP_PREFIX = "/aws/lambda/";
21
- export declare const LAMBDA_INSIGHTS_PREFIX = "/aws/lambda-insights";
22
- export declare const getSitesKey: (siteId: string) => string;
23
- export type RenderProgress = GenericRenderProgress<AwsProvider>;
24
- export declare const LAMBDA_CONCURRENCY_LIMIT_QUOTA = "L-B99A9384";
25
- export declare const REMOTION_BUCKET_PREFIX = "remotionlambda-";
package/dist/constants.js DELETED
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REMOTION_BUCKET_PREFIX = exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = exports.getSitesKey = exports.LAMBDA_INSIGHTS_PREFIX = exports.LOG_GROUP_PREFIX = exports.RENDER_FN_PREFIX = exports.DEFAULT_CLOUDWATCH_RETENTION_PERIOD = exports.DEFAULT_OUTPUT_PRIVACY = exports.MIN_EPHEMERAL_STORAGE_IN_MB = exports.DEFAULT_EPHEMERAL_STORAGE_IN_MB = exports.MAX_EPHEMERAL_STORAGE_IN_MB = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_REGION = exports.BINARY_NAME = exports.DEFAULT_FRAMES_PER_LAMBDA = exports.MAX_TIMEOUT = exports.MIN_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DEFAULT_MEMORY_SIZE = exports.MAX_MEMORY = exports.MIN_MEMORY = void 0;
4
- exports.MIN_MEMORY = 512;
5
- exports.MAX_MEMORY = 10240;
6
- exports.DEFAULT_MEMORY_SIZE = 2048;
7
- exports.DEFAULT_TIMEOUT = 120;
8
- exports.MIN_TIMEOUT = 15;
9
- exports.MAX_TIMEOUT = 900;
10
- exports.DEFAULT_FRAMES_PER_LAMBDA = 20;
11
- exports.BINARY_NAME = 'remotion lambda';
12
- exports.DEFAULT_REGION = 'us-east-1';
13
- exports.DEFAULT_MAX_RETRIES = 1;
14
- exports.MAX_EPHEMERAL_STORAGE_IN_MB = 10240;
15
- // TODO: In V5, Enable set this to 10240
16
- exports.DEFAULT_EPHEMERAL_STORAGE_IN_MB = 2048;
17
- exports.MIN_EPHEMERAL_STORAGE_IN_MB = 512;
18
- exports.DEFAULT_OUTPUT_PRIVACY = 'public';
19
- exports.DEFAULT_CLOUDWATCH_RETENTION_PERIOD = 14;
20
- exports.RENDER_FN_PREFIX = 'remotion-render-';
21
- exports.LOG_GROUP_PREFIX = '/aws/lambda/';
22
- exports.LAMBDA_INSIGHTS_PREFIX = '/aws/lambda-insights';
23
- const getSitesKey = (siteId) => `sites/${siteId}`;
24
- exports.getSitesKey = getSitesKey;
25
- exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = 'L-B99A9384';
26
- exports.REMOTION_BUCKET_PREFIX = 'remotionlambda-';
@@ -1,2 +0,0 @@
1
- import type { DownloadBehavior } from '@remotion/serverless-client';
2
- export declare const getContentDispositionHeader: (behavior: DownloadBehavior | null) => string | undefined;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getContentDispositionHeader = void 0;
4
- // By setting the Content-Disposition header in an S3 object,
5
- // you can control if the user downloads the item if you
6
- // visit the link
7
- const problematicCharacters = {
8
- '%3A': ':',
9
- '%2F': '/',
10
- '%3F': '?',
11
- '%23': '#',
12
- '%5B': '[',
13
- '%5D': ']',
14
- '%40': '@',
15
- '%21': '!',
16
- '%24': '$',
17
- '%26': '&',
18
- '%27': "'",
19
- '%28': '(',
20
- '%29': ')',
21
- '%2A': '*',
22
- '%2B': '+',
23
- '%2C': ',',
24
- '%3B': ';',
25
- };
26
- const includesHexOfUnsafeChar = (path) => {
27
- for (const key of Object.keys(problematicCharacters)) {
28
- if (path.includes(key)) {
29
- return { containsHex: true };
30
- }
31
- }
32
- return { containsHex: false };
33
- };
34
- const getContentDispositionHeader = (behavior) => {
35
- if (behavior === null) {
36
- return undefined;
37
- }
38
- if (behavior.type === 'play-in-browser') {
39
- return undefined;
40
- }
41
- if (behavior.fileName === null) {
42
- return `attachment`;
43
- }
44
- const { containsHex } = includesHexOfUnsafeChar(behavior.fileName);
45
- if (containsHex) {
46
- return `attachment; filename="${behavior.fileName}"`;
47
- }
48
- return `attachment; filename="${encodeURIComponent(behavior.fileName)}"`;
49
- };
50
- exports.getContentDispositionHeader = getContentDispositionHeader;
@@ -1,6 +0,0 @@
1
- import type { AwsRegion } from './regions';
2
- export declare const convertToServeUrlImplementation: ({ urlOrId, region, bucketName, }: {
3
- urlOrId: string;
4
- region: AwsRegion;
5
- bucketName: string;
6
- }) => string;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertToServeUrlImplementation = void 0;
4
- const serverless_client_1 = require("@remotion/serverless-client");
5
- const convertToServeUrlImplementation = ({ urlOrId, region, bucketName, }) => {
6
- if (urlOrId.startsWith('src/')) {
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 ${serverless_client_1.DOCS_URL}/docs/lambda/setup`);
8
- }
9
- if (urlOrId.startsWith('http://') || urlOrId.startsWith('https://')) {
10
- return urlOrId;
11
- }
12
- return `https://${bucketName}.s3.${region}.amazonaws.com/sites/${urlOrId}/index.html`;
13
- };
14
- exports.convertToServeUrlImplementation = convertToServeUrlImplementation;
@@ -1,3 +0,0 @@
1
- import type { ProviderSpecifics } from '@remotion/serverless-client';
2
- import type { AwsProvider } from './aws-provider';
3
- export declare const createBucket: ProviderSpecifics<AwsProvider>['createBucket'];
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createBucket = void 0;
4
- const client_s3_1 = require("@aws-sdk/client-s3");
5
- const get_s3_client_1 = require("./get-s3-client");
6
- const createBucket = async ({ region, bucketName, forcePathStyle, requestHandler }) => {
7
- await (0, get_s3_client_1.getS3Client)({
8
- region,
9
- customCredentials: null,
10
- forcePathStyle,
11
- requestHandler,
12
- }).send(new client_s3_1.CreateBucketCommand({
13
- Bucket: bucketName,
14
- }));
15
- try {
16
- await (0, get_s3_client_1.getS3Client)({
17
- region,
18
- customCredentials: null,
19
- forcePathStyle,
20
- requestHandler,
21
- }).send(new client_s3_1.DeleteBucketOwnershipControlsCommand({
22
- Bucket: bucketName,
23
- }));
24
- }
25
- catch (err) {
26
- if (err.message.includes('Access Denied')) {
27
- throw new Error('Since April 2023, more AWS permissions are required to create an S3 bucket. You need to update your user policy to continue. See https://remotion.dev/docs/lambda/s3-public-access for instructions on how to resolve this issue.');
28
- }
29
- throw err;
30
- }
31
- try {
32
- await (0, get_s3_client_1.getS3Client)({
33
- region,
34
- customCredentials: null,
35
- forcePathStyle,
36
- requestHandler,
37
- }).send(new client_s3_1.DeletePublicAccessBlockCommand({
38
- Bucket: bucketName,
39
- }));
40
- }
41
- catch (err) {
42
- if (err.message.includes('Access Denied')) {
43
- throw new Error('PARTIAL SUCCESS: The s3:PutBucketOwnershipControls was found, but the s3:PutBucketPublicAccessBlock permission is not given. Since April 2023, more AWS permissions are required to create an S3 bucket. You need to update your user policy to continue. You need to update your user policy to continue. See https://remotion.dev/docs/lambda/s3-public-access for instructions on how to resolve this issue.');
44
- }
45
- throw err;
46
- }
47
- try {
48
- await (0, get_s3_client_1.getS3Client)({
49
- region,
50
- customCredentials: null,
51
- forcePathStyle,
52
- requestHandler,
53
- }).send(new client_s3_1.PutBucketAclCommand({
54
- Bucket: bucketName,
55
- ACL: 'public-read',
56
- }));
57
- }
58
- catch (err) {
59
- if (err.message.includes('The bucket does not allow ACLs')) {
60
- throw new Error(`Could not add an ACL to the bucket. This might have happened because the bucket was already successfully created before but then failed to configure correctly. We recommend to delete the bucket (${bucketName}) if it is empty and start over to fix the problem.`);
61
- }
62
- throw err;
63
- }
64
- };
65
- exports.createBucket = createBucket;
@@ -1,3 +0,0 @@
1
- import type { ProviderSpecifics } from '@remotion/serverless-client';
2
- import type { AwsProvider } from './aws-provider';
3
- export declare const lambdaDeleteFileImplementation: ProviderSpecifics<AwsProvider>['deleteFile'];
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lambdaDeleteFileImplementation = void 0;
4
- const client_s3_1 = require("@aws-sdk/client-s3");
5
- const get_s3_client_1 = require("./get-s3-client");
6
- const lambdaDeleteFileImplementation = async ({ bucketName, key, region, customCredentials, forcePathStyle, requestHandler, }) => {
7
- await (0, get_s3_client_1.getS3Client)({
8
- region,
9
- customCredentials,
10
- forcePathStyle,
11
- requestHandler,
12
- }).send(new client_s3_1.DeleteObjectCommand({
13
- Bucket: bucketName,
14
- Key: key,
15
- }));
16
- };
17
- exports.lambdaDeleteFileImplementation = lambdaDeleteFileImplementation;
@@ -1,7 +0,0 @@
1
- import type { DeleteFunction, DeleteFunctionInput as GenericDeleteFunctionInput } from '@remotion/serverless-client';
2
- import type { AwsProvider } from './aws-provider';
3
- import type { RequestHandler } from './types';
4
- export type DeleteFunctionInput = GenericDeleteFunctionInput<AwsProvider> & {
5
- requestHandler?: RequestHandler;
6
- };
7
- export declare const deleteFunction: DeleteFunction<AwsProvider>;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteFunction = void 0;
4
- const client_lambda_1 = require("@aws-sdk/client-lambda");
5
- const aws_clients_1 = require("./aws-clients");
6
- /*
7
- * @description Deletes a deployed Lambda function based on its name.
8
- * @see [Documentation](https://remotion.dev/docs/lambda/deletefunction)
9
- */
10
- const deleteFunction = async ({ region, functionName, requestHandler, }) => {
11
- await (0, aws_clients_1.getLambdaClient)(region, undefined, requestHandler !== null && requestHandler !== void 0 ? requestHandler : null).send(new client_lambda_1.DeleteFunctionCommand({
12
- FunctionName: functionName,
13
- }));
14
- };
15
- exports.deleteFunction = deleteFunction;
@@ -1,22 +0,0 @@
1
- import type { ProviderSpecifics } from '@remotion/serverless-client';
2
- import { type CustomCredentials } from '@remotion/serverless-client';
3
- import type { AwsProvider } from './aws-provider';
4
- import type { AwsRegion } from './regions';
5
- import type { RequestHandler } from './types';
6
- export type DeleteRenderInput = {
7
- region: AwsRegion;
8
- bucketName: string;
9
- renderId: string;
10
- customCredentials?: CustomCredentials<AwsProvider>;
11
- forcePathStyle?: boolean;
12
- requestHandler?: RequestHandler;
13
- };
14
- export declare const internalDeleteRender: (input: DeleteRenderInput & {
15
- providerSpecifics: ProviderSpecifics<AwsProvider>;
16
- forcePathStyle: boolean;
17
- }) => Promise<{
18
- freedBytes: number;
19
- }>;
20
- export declare const deleteRender: (input: DeleteRenderInput) => Promise<{
21
- freedBytes: number;
22
- }>;