@remotion/lambda-client 4.0.398 → 4.0.399
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.
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +39 -33
- package/dist/cjs/make-lambda-payload.d.ts +2 -2
- package/dist/esm/index.mjs +26 -20
- package/package.json +3 -3
- package/dist/app-router-webhook.d.ts +0 -10
- package/dist/app-router-webhook.js +0 -43
- package/dist/apply-lifecycle.d.ts +0 -8
- package/dist/apply-lifecycle.js +0 -18
- package/dist/aws-clients.d.ts +0 -12
- package/dist/aws-clients.js +0 -56
- package/dist/aws-provider.d.ts +0 -27
- package/dist/aws-provider.js +0 -94
- package/dist/bucket-exists.d.ts +0 -3
- package/dist/bucket-exists.js +0 -27
- package/dist/call-lambda-async.d.ts +0 -2
- package/dist/call-lambda-async.js +0 -20
- package/dist/call-lambda-streaming.d.ts +0 -6
- package/dist/call-lambda-streaming.js +0 -126
- package/dist/call-lambda-sync.d.ts +0 -2
- package/dist/call-lambda-sync.js +0 -30
- package/dist/check-credentials.d.ts +0 -1
- package/dist/check-credentials.js +0 -39
- package/dist/clean-items.d.ts +0 -17
- package/dist/clean-items.js +0 -26
- package/dist/constants.d.ts +0 -25
- package/dist/constants.js +0 -26
- package/dist/content-disposition-header.d.ts +0 -2
- package/dist/content-disposition-header.js +0 -50
- package/dist/convert-to-serve-url.d.ts +0 -6
- package/dist/convert-to-serve-url.js +0 -14
- package/dist/create-bucket.d.ts +0 -3
- package/dist/create-bucket.js +0 -65
- package/dist/delete-file.d.ts +0 -3
- package/dist/delete-file.js +0 -17
- package/dist/delete-function.d.ts +0 -7
- package/dist/delete-function.js +0 -15
- package/dist/delete-render.d.ts +0 -22
- package/dist/delete-render.js +0 -90
- package/dist/encode-aws-url-params.d.ts +0 -1
- package/dist/encode-aws-url-params.js +0 -7
- package/dist/estimate-price.d.ts +0 -17
- package/dist/estimate-price.js +0 -45
- package/dist/express-webhook.d.ts +0 -3
- package/dist/express-webhook.js +0 -46
- package/dist/get-account-id.d.ts +0 -3
- package/dist/get-account-id.js +0 -15
- package/dist/get-aws-client.d.ts +0 -32
- package/dist/get-aws-client.js +0 -67
- package/dist/get-aws-urls.d.ts +0 -25
- package/dist/get-aws-urls.js +0 -31
- package/dist/get-buckets.d.ts +0 -9
- package/dist/get-buckets.js +0 -64
- package/dist/get-compositions-on-lambda.d.ts +0 -20
- package/dist/get-compositions-on-lambda.js +0 -62
- package/dist/get-credentials.d.ts +0 -9
- package/dist/get-credentials.js +0 -55
- package/dist/get-env-variable.d.ts +0 -1
- package/dist/get-env-variable.js +0 -15
- package/dist/get-function-name.d.ts +0 -8
- package/dist/get-function-name.js +0 -17
- package/dist/get-function-version.d.ts +0 -9
- package/dist/get-function-version.js +0 -35
- package/dist/get-functions.d.ts +0 -10
- package/dist/get-functions.js +0 -80
- package/dist/get-output-url-from-metadata.d.ts +0 -3
- package/dist/get-output-url-from-metadata.js +0 -18
- package/dist/get-render-progress.d.ts +0 -17
- package/dist/get-render-progress.js +0 -47
- package/dist/get-s3-client.d.ts +0 -11
- package/dist/get-s3-client.js +0 -15
- package/dist/get-service-client.d.ts +0 -25
- package/dist/get-service-client.js +0 -131
- package/dist/get-sites.d.ts +0 -31
- package/dist/get-sites.js +0 -83
- package/dist/head-file.d.ts +0 -3
- package/dist/head-file.js +0 -18
- package/dist/index.d.ts +0 -129
- package/dist/index.js +0 -108
- package/dist/is-cli.d.ts +0 -2
- package/dist/is-cli.js +0 -10
- package/dist/is-flaky-error.d.ts +0 -1
- package/dist/is-flaky-error.js +0 -78
- package/dist/is-in-lambda.d.ts +0 -1
- package/dist/is-in-lambda.js +0 -9
- package/dist/is-likely-to-have-aws-profile.d.ts +0 -1
- package/dist/is-likely-to-have-aws-profile.js +0 -50
- package/dist/lambda-version-string.d.ts +0 -1
- package/dist/lambda-version-string.js +0 -7
- package/dist/lifecycle-rules.d.ts +0 -12
- package/dist/lifecycle-rules.js +0 -73
- package/dist/lifecycle.d.ts +0 -7
- package/dist/lifecycle.js +0 -24
- package/dist/list-objects.d.ts +0 -3
- package/dist/list-objects.js +0 -70
- package/dist/make-lambda-payload.d.ts +0 -59
- package/dist/make-lambda-payload.js +0 -150
- package/dist/make-s3-url.d.ts +0 -6
- package/dist/make-s3-url.js +0 -7
- package/dist/p-limit.d.ts +0 -1
- package/dist/p-limit.js +0 -57
- package/dist/pages-router-webhook.d.ts +0 -5
- package/dist/pages-router-webhook.js +0 -48
- package/dist/parse-function-name.d.ts +0 -8
- package/dist/parse-function-name.js +0 -17
- package/dist/presign-url.d.ts +0 -17
- package/dist/presign-url.js +0 -66
- package/dist/price-per-1s.d.ts +0 -37
- package/dist/price-per-1s.js +0 -822
- package/dist/random-hash.d.ts +0 -1
- package/dist/random-hash.js +0 -13
- package/dist/read-file.d.ts +0 -11
- package/dist/read-file.js +0 -19
- package/dist/regions.d.ts +0 -3
- package/dist/regions.js +0 -48
- package/dist/render-media-on-lambda.d.ts +0 -66
- package/dist/render-media-on-lambda.js +0 -133
- package/dist/render-still-on-lambda.d.ts +0 -61
- package/dist/render-still-on-lambda.js +0 -121
- package/dist/runtime-preference.d.ts +0 -2
- package/dist/runtime-preference.js +0 -8
- package/dist/speculate-function-name.d.ts +0 -7
- package/dist/speculate-function-name.js +0 -39
- package/dist/types.d.ts +0 -4
- package/dist/types.js +0 -2
- package/dist/validate-aws-region.d.ts +0 -2
- package/dist/validate-aws-region.js +0 -9
- package/dist/validate-bucketname.d.ts +0 -4
- package/dist/validate-bucketname.js +0 -15
- package/dist/validate-disk-size-in-mb.d.ts +0 -1
- package/dist/validate-disk-size-in-mb.js +0 -23
- package/dist/validate-lambda-codec.d.ts +0 -2
- package/dist/validate-lambda-codec.js +0 -21
- package/dist/validate-memory-size.d.ts +0 -1
- package/dist/validate-memory-size.js +0 -22
- package/dist/validate-presign-expiration.d.ts +0 -1
- package/dist/validate-presign-expiration.js +0 -29
- package/dist/validate-serveurl.d.ts +0 -1
- package/dist/validate-serveurl.js +0 -9
- package/dist/validate-webhook-signature.d.ts +0 -5
- package/dist/validate-webhook-signature.js +0 -28
- package/dist/write-file.d.ts +0 -5
- package/dist/write-file.js +0 -83
package/dist/aws-provider.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { AwsRegion } from './regions';
|
|
2
|
-
export type AwsProvider = {
|
|
3
|
-
type: 'aws';
|
|
4
|
-
region: AwsRegion;
|
|
5
|
-
receivedArtifactType: {
|
|
6
|
-
s3Key: string;
|
|
7
|
-
s3Url: string;
|
|
8
|
-
};
|
|
9
|
-
creationFunctionOptions: {
|
|
10
|
-
createCloudWatchLogGroup: boolean;
|
|
11
|
-
accountId: string;
|
|
12
|
-
alreadyCreated: boolean;
|
|
13
|
-
retentionInDays: number;
|
|
14
|
-
customRoleArn: string;
|
|
15
|
-
enableLambdaInsights: boolean;
|
|
16
|
-
vpcSubnetIds: string;
|
|
17
|
-
vpcSecurityGroupIds: string;
|
|
18
|
-
runtimePreference: RuntimePreference;
|
|
19
|
-
};
|
|
20
|
-
storageClass: StorageClass;
|
|
21
|
-
requestHandler: RequestHandler | null | undefined;
|
|
22
|
-
};
|
|
23
|
-
import type { StorageClass } from '@aws-sdk/client-s3';
|
|
24
|
-
import type { ProviderSpecifics } from '@remotion/serverless-client';
|
|
25
|
-
import type { RuntimePreference } from './runtime-preference';
|
|
26
|
-
import type { RequestHandler } from './types';
|
|
27
|
-
export declare const awsImplementation: ProviderSpecifics<AwsProvider>;
|
package/dist/aws-provider.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.awsImplementation = void 0;
|
|
5
|
-
const serverless_client_1 = require("@remotion/serverless-client");
|
|
6
|
-
const node_events_1 = require("node:events");
|
|
7
|
-
const bucket_exists_1 = require("./bucket-exists");
|
|
8
|
-
const call_lambda_async_1 = require("./call-lambda-async");
|
|
9
|
-
const call_lambda_streaming_1 = require("./call-lambda-streaming");
|
|
10
|
-
const call_lambda_sync_1 = require("./call-lambda-sync");
|
|
11
|
-
const check_credentials_1 = require("./check-credentials");
|
|
12
|
-
const constants_1 = require("./constants");
|
|
13
|
-
const convert_to_serve_url_1 = require("./convert-to-serve-url");
|
|
14
|
-
const create_bucket_1 = require("./create-bucket");
|
|
15
|
-
const delete_file_1 = require("./delete-file");
|
|
16
|
-
const delete_function_1 = require("./delete-function");
|
|
17
|
-
const estimate_price_1 = require("./estimate-price");
|
|
18
|
-
const get_account_id_1 = require("./get-account-id");
|
|
19
|
-
const get_aws_urls_1 = require("./get-aws-urls");
|
|
20
|
-
const get_buckets_1 = require("./get-buckets");
|
|
21
|
-
const get_functions_1 = require("./get-functions");
|
|
22
|
-
const get_output_url_from_metadata_1 = require("./get-output-url-from-metadata");
|
|
23
|
-
const head_file_1 = require("./head-file");
|
|
24
|
-
const is_flaky_error_1 = require("./is-flaky-error");
|
|
25
|
-
const lifecycle_rules_1 = require("./lifecycle-rules");
|
|
26
|
-
const list_objects_1 = require("./list-objects");
|
|
27
|
-
const parse_function_name_1 = require("./parse-function-name");
|
|
28
|
-
const random_hash_1 = require("./random-hash");
|
|
29
|
-
const read_file_1 = require("./read-file");
|
|
30
|
-
const write_file_1 = require("./write-file");
|
|
31
|
-
if (/^AWS_Lambda_nodejs(?:18|20)[.]x$/.test((_a = process.env.AWS_EXECUTION_ENV) !== null && _a !== void 0 ? _a : '') === true) {
|
|
32
|
-
process.env.FONTCONFIG_PATH = '/opt';
|
|
33
|
-
process.env.FONTCONFIG_FILE = '/opt/fonts.conf';
|
|
34
|
-
process.env.DISABLE_FROM_SURFACE = '1';
|
|
35
|
-
process.env.NO_COLOR = '1';
|
|
36
|
-
// @ts-expect-error
|
|
37
|
-
globalThis._dumpUnreleasedBuffers = new node_events_1.EventEmitter();
|
|
38
|
-
// @ts-expect-error
|
|
39
|
-
globalThis._dumpUnreleasedBuffers.setMaxListeners(201);
|
|
40
|
-
}
|
|
41
|
-
const validateDeleteAfter = (lifeCycleValue) => {
|
|
42
|
-
if (lifeCycleValue === null) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (lifeCycleValue === undefined) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (typeof lifeCycleValue !== 'string') {
|
|
49
|
-
throw new TypeError(`Expected life cycle value to be a string, got ${JSON.stringify(lifeCycleValue)}`);
|
|
50
|
-
}
|
|
51
|
-
if (!(lifeCycleValue in serverless_client_1.expiryDays)) {
|
|
52
|
-
throw new TypeError(`Expected deleteAfter value to be one of ${Object.keys(serverless_client_1.expiryDays).join(', ')}, got ${lifeCycleValue}`);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
exports.awsImplementation = {
|
|
56
|
-
getChromiumPath() {
|
|
57
|
-
return '/opt/bin/chromium';
|
|
58
|
-
},
|
|
59
|
-
getBuckets: get_buckets_1.getRemotionBuckets,
|
|
60
|
-
createBucket: create_bucket_1.createBucket,
|
|
61
|
-
applyLifeCycle: lifecycle_rules_1.applyLifeCyleOperation,
|
|
62
|
-
listObjects: list_objects_1.lambdaLsImplementation,
|
|
63
|
-
deleteFile: delete_file_1.lambdaDeleteFileImplementation,
|
|
64
|
-
bucketExists: bucket_exists_1.bucketExistsInRegionImplementation,
|
|
65
|
-
randomHash: random_hash_1.randomHashImplementation,
|
|
66
|
-
readFile: read_file_1.lambdaReadFileImplementation,
|
|
67
|
-
writeFile: write_file_1.lambdaWriteFileImplementation,
|
|
68
|
-
headFile: head_file_1.lambdaHeadFileImplementation,
|
|
69
|
-
convertToServeUrl: convert_to_serve_url_1.convertToServeUrlImplementation,
|
|
70
|
-
printLoggingHelper: true,
|
|
71
|
-
validateDeleteAfter,
|
|
72
|
-
callFunctionAsync: call_lambda_async_1.callFunctionAsyncImplementation,
|
|
73
|
-
callFunctionStreaming: call_lambda_streaming_1.callFunctionWithStreamingImplementation,
|
|
74
|
-
callFunctionSync: call_lambda_sync_1.callFunctionSyncImplementation,
|
|
75
|
-
getEphemeralStorageForPriceCalculation() {
|
|
76
|
-
// We cannot determine the ephemeral storage size, so we
|
|
77
|
-
// overestimate the price, but will only have a miniscule effect (~0.2%)
|
|
78
|
-
return constants_1.MAX_EPHEMERAL_STORAGE_IN_MB;
|
|
79
|
-
},
|
|
80
|
-
estimatePrice: estimate_price_1.estimatePrice,
|
|
81
|
-
getLoggingUrlForMethod: get_aws_urls_1.getCloudwatchMethodUrl,
|
|
82
|
-
getLoggingUrlForRendererFunction: get_aws_urls_1.getCloudwatchRendererUrl,
|
|
83
|
-
isFlakyError: is_flaky_error_1.isFlakyError,
|
|
84
|
-
getOutputUrl: get_output_url_from_metadata_1.getOutputUrlFromMetadata,
|
|
85
|
-
serverStorageProductName: () => 'S3',
|
|
86
|
-
getMaxStillInlinePayloadSize: () => 5000000,
|
|
87
|
-
getMaxNonInlinePayloadSizePerFunction: () => 200000,
|
|
88
|
-
getAccountId: get_account_id_1.getAccountIdImplementation,
|
|
89
|
-
deleteFunction: delete_function_1.deleteFunction,
|
|
90
|
-
getFunctions: get_functions_1.getFunctions,
|
|
91
|
-
parseFunctionName: parse_function_name_1.parseFunctionName,
|
|
92
|
-
checkCredentials: check_credentials_1.checkCredentials,
|
|
93
|
-
getBucketPrefix: () => constants_1.REMOTION_BUCKET_PREFIX,
|
|
94
|
-
};
|
package/dist/bucket-exists.d.ts
DELETED
package/dist/bucket-exists.js
DELETED
|
@@ -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]>;
|
package/dist/call-lambda-sync.js
DELETED
|
@@ -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;
|
package/dist/clean-items.d.ts
DELETED
|
@@ -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[]>;
|
package/dist/clean-items.js
DELETED
|
@@ -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;
|
package/dist/constants.d.ts
DELETED
|
@@ -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,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,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;
|
package/dist/create-bucket.d.ts
DELETED
package/dist/create-bucket.js
DELETED
|
@@ -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;
|
package/dist/delete-file.d.ts
DELETED