Skip to content

🎥 Make videos programmatically with React

alright

Jonny Burgerf5000cce2bf3
diff --git a/packages/lambda/src/api/download-media.ts b/packages/lambda/src/api/download-media.ts
index f55c0ecc54..8c533fbab7 100644
--- a/packages/lambda/src/api/download-media.ts
+++ b/packages/lambda/src/api/download-media.ts
@@ -1,10 +1,12 @@
import {RenderInternals} from '@remotion/renderer';
import path from 'path';
import {getExpectedOutName} from '../functions/helpers/expected-out-name';
+import {getCustomOutName} from '../functions/helpers/get-custom-out-name';
import {getRenderMetadata} from '../functions/helpers/get-render-metadata';
import type {LambdaReadFileProgress} from '../functions/helpers/read-with-progress';
import {lambdaDownloadFileWithProgress} from '../functions/helpers/read-with-progress';
import type {AwsRegion} from '../pricing/aws-regions';
+import type {CustomCredentials} from '../shared/aws-clients';
import {getAccountId} from '../shared/get-account-id';
export type DownloadMediaInput = {
@@ -13,6 +15,7 @@ export type DownloadMediaInput = {
renderId: string;
outPath: string;
onProgress?: LambdaReadFileProgress;
+ customCredentials?: CustomCredentials;
};
export type DownloadMediaOutput = {
@@ -35,10 +38,16 @@ export const downloadMedia = async (
const outputPath = path.resolve(process.cwd(), input.outPath);
RenderInternals.ensureOutputDirectory(outputPath);
- const {key, renderBucketName} = getExpectedOutName(
+
+ const {key, renderBucketName, customCredentials} = getExpectedOutName(
renderMetadata,
- input.bucketName
+ input.bucketName,
+ getCustomOutName({
+ renderMetadata,
+ customCredentials: input.customCredentials ?? null,
+ })
);
+
const {sizeInBytes} = await lambdaDownloadFileWithProgress({
bucketName: renderBucketName,
expectedBucketOwner,
@@ -46,6 +55,7 @@ export const downloadMedia = async (
region: input.region,
onProgress: input.onProgress ?? (() => undefined),
outputPath,
+ customCredentials,
});
return {
diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.ts
index 1bd4de0148..f801c0c8fc 100644
--- a/packages/lambda/src/cli/commands/render/render.ts
+++ b/packages/lambda/src/cli/commands/render/render.ts
@@ -101,7 +101,15 @@ export const renderCommand = async (args: string[]) => {
privacy,
logLevel,
frameRange: frameRange ?? undefined,
- outName: parsedLambdaCli['out-name'],
+ outName: {
+ bucketName: 'remotion-lambda-target',
+ key: 'out-file.mp4',
+ customS3Implementation: {
+ endpoint: 'https://fra1.digitaloceanspaces.com',
+ accessKeyId: process.env.SPACES_ACCESS_KEY as string,
+ secretAccessKey: process.env.SPACES_ACCESS_SECRET as string,
+ },
+ },
timeoutInMilliseconds: puppeteerTimeout,
chromiumOptions,
scale,
diff --git a/packages/lambda/src/functions/helpers/expected-out-name.ts b/packages/lambda/src/functions/helpers/expected-out-name.ts
index c34cd06e08..873d5d520c 100644
--- a/packages/lambda/src/functions/helpers/expected-out-name.ts
+++ b/packages/lambda/src/functions/helpers/expected-out-name.ts
@@ -1,20 +1,17 @@
import type {Codec} from '@remotion/renderer';
import {RenderInternals} from '@remotion/renderer';
-import type {OutNameOutput, RenderMetadata} from '../../defaults';
+import type {OutNameInput, OutNameOutput, RenderMetadata} from '../../defaults';
import {customOutName, outName, outStillName} from '../../defaults';
import {validateOutname} from '../../shared/validate-outname';
export const getExpectedOutName = (
renderMetadata: RenderMetadata,
- bucketName: string
+ bucketName: string,
+ outNameValue: OutNameInput | null
): OutNameOutput => {
- if (renderMetadata.outName) {
- validateOutname(renderMetadata.outName);
- return customOutName(
- renderMetadata.renderId,
- bucketName,
- renderMetadata.outName
- );
+ if (outNameValue) {
+ validateOutname(outNameValue);
+ return customOutName(renderMetadata.renderId, bucketName, outNameValue);
}
if (renderMetadata.type === 'still') {
diff --git a/packages/lambda/src/functions/helpers/find-output-file-in-bucket.ts b/packages/lambda/src/functions/helpers/find-output-file-in-bucket.ts
index 06d0bfa871..c2868d59be 100644
--- a/packages/lambda/src/functions/helpers/find-output-file-in-bucket.ts
+++ b/packages/lambda/src/functions/helpers/find-output-file-in-bucket.ts
@@ -1,8 +1,9 @@
import {HeadObjectCommand} from '@aws-sdk/client-s3';
import type {AwsRegion} from '../..';
import {ROLE_NAME} from '../../api/iam-validation/suggested-policy';
+import type {CustomCredentials} from '../../shared/aws-clients';
import {getS3Client} from '../../shared/aws-clients';
-import type {RenderMetadata} from '../../shared/constants';
+import type {OutNameInput, RenderMetadata} from '../../shared/constants';
import {getExpectedOutName} from './expected-out-name';
import {getOutputUrlFromMetadata} from './get-output-url-from-metadata';
@@ -16,28 +17,36 @@ export const findOutputFileInBucket = async ({
region,
renderMetadata,
bucketName,
+ customCredentials,
+ outNameValue,
}: {
region: AwsRegion;
renderMetadata: RenderMetadata;
bucketName: string;
+ customCredentials: CustomCredentials | null;
+ outNameValue: OutNameInput | null;
}): Promise<OutputFileMetadata | null> => {
if (!renderMetadata) {
throw new Error('unexpectedly did not get renderMetadata');
}
- const expectedOutData = getExpectedOutName(renderMetadata, bucketName);
+ const {renderBucketName, key} = getExpectedOutName(
+ renderMetadata,
+ bucketName,
+ null
+ );
try {
- const head = await getS3Client(region, null).send(
+ const head = await getS3Client(region, customCredentials).send(
new HeadObjectCommand({
- Bucket: expectedOutData.renderBucketName,
- Key: expectedOutData.key,
+ Bucket: renderBucketName,
+ Key: key,
})
);
return {
lastModified: head.LastModified?.getTime() as number,
size: head.ContentLength as number,
- url: getOutputUrlFromMetadata(renderMetadata, bucketName),
+ url: getOutputUrlFromMetadata(renderMetadata, bucketName, outNameValue),
};
} catch (err) {
if ((err as Error).name === 'NotFound') {
@@ -50,7 +59,7 @@ export const findOutputFileInBucket = async ({
.httpStatusCode === 403
) {
throw new Error(
- `Unable to access item "${expectedOutData.key}" from bucket "${expectedOutData.renderBucketName}". The "${ROLE_NAME}" role must have permission for both "s3:GetObject" and "s3:ListBucket" actions.`
+ `Unable to access item "${key}" from bucket "${renderBucketName}". The "${ROLE_NAME}" role must have permission for both "s3:GetObject" and "s3:ListBucket" actions.`
);
}
diff --git a/packages/lambda/src/functions/helpers/get-custom-out-name.ts b/packages/lambda/src/functions/helpers/get-custom-out-name.ts
new file mode 100644
index 0000000000..103ca8086b
--- /dev/null
+++ b/packages/lambda/src/functions/helpers/get-custom-out-name.ts
@@ -0,0 +1,41 @@
+import type {OutNameInput, RenderMetadata} from '../../defaults';
+import type {CustomCredentials} from '../../shared/aws-clients';
+
+export const getCustomOutName = ({
+ renderMetadata,
+ customCredentials,
+}: {
+ renderMetadata: RenderMetadata;
+ customCredentials: CustomCredentials | null;
+}): OutNameInput | null => {
+ if (!renderMetadata.outName) {
+ return null;
+ }
+
+ if (typeof renderMetadata.outName === 'string') {
+ return renderMetadata.outName;
+ }
+
+ if (renderMetadata.outName.customS3Implementation) {
+ if (!customCredentials && renderMetadata.privacy !== 'public') {
+ throw new TypeError(
+ `The file was rendered with a custom S3 implementation and is not public, but no custom credentials were passed to the downloadMedia().`
+ );
+ }
+
+ return {
+ bucketName: renderMetadata.outName.bucketName,
+ key: renderMetadata.outName.key,
+ customS3Implementation: {
+ endpoint: renderMetadata.outName.customS3Implementation.endpoint,
+ accessKeyId: customCredentials?.accessKeyId ?? null,
+ secretAccessKey: customCredentials?.secretAccessKey ?? null,
+ },
+ };
+ }
+
+ return {
+ bucketName: renderMetadata.outName.bucketName,
+ key: renderMetadata.outName.key,
+ };
+};
diff --git a/packages/lambda/src/functions/helpers/get-output-url-from-metadata.ts b/packages/lambda/src/functions/helpers/get-output-url-from-metadata.ts
index be09185ccb..7833276db0 100644
--- a/packages/lambda/src/functions/helpers/get-output-url-from-metadata.ts
+++ b/packages/lambda/src/functions/helpers/get-output-url-from-metadata.ts
@@ -1,12 +1,13 @@
-import type {RenderMetadata} from '../../defaults';
+import type {OutNameInput, RenderMetadata} from '../../defaults';
import {getExpectedOutName} from './expected-out-name';
import {getCurrentRegionInFunction} from './get-current-region';
export const getOutputUrlFromMetadata = (
renderMetadata: RenderMetadata,
- bucketName: string
+ bucketName: string,
+ outName: OutNameInput | null
) => {
- const outname = getExpectedOutName(renderMetadata, bucketName);
+ const outname = getExpectedOutName(renderMetadata, bucketName, outName);
return `https://s3.${getCurrentRegionInFunction()}.amazonaws.com/${
outname.renderBucketName
}/${outname.key}`;
diff --git a/packages/lambda/src/functions/helpers/get-progress.ts b/packages/lambda/src/functions/helpers/get-progress.ts
index 5476cbbf13..feaaa290ef 100644
--- a/packages/lambda/src/functions/helpers/get-progress.ts
+++ b/packages/lambda/src/functions/helpers/get-progress.ts
@@ -1,5 +1,6 @@
import {Internals} from 'remotion';
import type {AwsRegion} from '../../pricing/aws-regions';
+import type {CustomCredentials} from '../../shared/aws-clients';
import type {RenderProgress} from '../../shared/constants';
import {
chunkKey,
@@ -18,6 +19,7 @@ import {formatCostsInfo} from './format-costs-info';
import {getCleanupProgress} from './get-cleanup-progress';
import {getCurrentArchitecture} from './get-current-architecture';
import {getCurrentRegionInFunction} from './get-current-region';
+import {getCustomOutName} from './get-custom-out-name';
import {getEncodingMetadata} from './get-encoding-metadata';
import {getFinalEncodingStatus} from './get-final-encoding-status';
import {getLambdasInvokedStats} from './get-lambdas-invoked-stats';
@@ -37,6 +39,7 @@ export const getProgress = async ({
region,
memorySizeInMb,
timeoutInMiliseconds,
+ customCredentials,
}: {
bucketName: string;
renderId: string;
@@ -44,6 +47,7 @@ export const getProgress = async ({
region: AwsRegion;
memorySizeInMb: number;
timeoutInMiliseconds: number;
+ customCredentials: CustomCredentials | null;
}): Promise<RenderProgress> => {
const postRenderData = await getPostRenderData({
bucketName,
@@ -55,7 +59,11 @@ export const getProgress = async ({
if (postRenderData) {
const outData = getExpectedOutName(
postRenderData.renderMetadata,
- bucketName
+ bucketName,
+ getCustomOutName({
+ customCredentials,
+ renderMetadata: postRenderData.renderMetadata,
+ })
);
return {
bucket: bucketName,
@@ -156,6 +164,8 @@ export const getProgress = async ({
bucketName,
renderMetadata,
region,
+ customCredentials,
+ outNameValue: getCustomOutName({customCredentials, renderMetadata}),
})
: null;
@@ -281,11 +291,19 @@ export const getProgress = async ({
retriesInfo,
outKey:
outputFile && renderMetadata
- ? getExpectedOutName(renderMetadata, bucketName).key
+ ? getExpectedOutName(
+ renderMetadata,
+ bucketName,
+ getCustomOutName({customCredentials, renderMetadata})
+ ).key
: null,
outBucket:
outputFile && renderMetadata
- ? getExpectedOutName(renderMetadata, bucketName).renderBucketName
+ ? getExpectedOutName(
+ renderMetadata,
+ bucketName,
+ getCustomOutName({customCredentials, renderMetadata})
+ ).renderBucketName
: null,
mostExpensiveFrameRanges: null,
};
diff --git a/packages/lambda/src/functions/helpers/read-with-progress.ts b/packages/lambda/src/functions/helpers/read-with-progress.ts
index 90ea042f2d..61196a8b2b 100644
--- a/packages/lambda/src/functions/helpers/read-with-progress.ts
+++ b/packages/lambda/src/functions/helpers/read-with-progress.ts
@@ -2,6 +2,7 @@ import {GetObjectCommand} from '@aws-sdk/client-s3';
import {getSignedUrl} from '@aws-sdk/s3-request-presigner';
import {RenderInternals} from '@remotion/renderer';
import type {AwsRegion} from '../../pricing/aws-regions';
+import type {CustomCredentials} from '../../shared/aws-clients';
import {getS3Client} from '../../shared/aws-clients';
export type LambdaReadFileProgress = (progress: {
@@ -17,6 +18,7 @@ export const lambdaDownloadFileWithProgress = async ({
expectedBucketOwner,
outputPath,
onProgress,
+ customCredentials,
}: {
bucketName: string;
key: string;
@@ -24,8 +26,9 @@ export const lambdaDownloadFileWithProgress = async ({
expectedBucketOwner: string;
outputPath: string;
onProgress: LambdaReadFileProgress;
+ customCredentials: CustomCredentials | null;
}): Promise<{sizeInBytes: number; to: string}> => {
- const client = getS3Client(region, null);
+ const client = getS3Client(region, customCredentials);
const command = new GetObjectCommand({
Bucket: bucketName,
ExpectedBucketOwner: expectedBucketOwner,
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index 0b4f9e96b0..50dba29321 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -40,6 +40,7 @@ import {cleanupFiles} from './helpers/delete-chunks';
import {getExpectedOutName} from './helpers/expected-out-name';
import {getBrowserInstance} from './helpers/get-browser-instance';
import {getCurrentRegionInFunction} from './helpers/get-current-region';
+import {getCustomOutName} from './helpers/get-custom-out-name';
import {getFilesToDelete} from './helpers/get-files-to-delete';
import {getLambdasInvokedStats} from './helpers/get-lambdas-invoked-stats';
import {getOutputUrlFromMetadata} from './helpers/get-output-url-from-metadata';
@@ -240,6 +241,7 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
region: getCurrentRegionInFunction(),
renderId: params.renderId,
outName: params.outName ?? undefined,
+ privacy: params.privacy,
};
await lambdaWriteFile({
@@ -340,7 +342,8 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
const {key, renderBucketName, customCredentials} = getExpectedOutName(
renderMetadata,
- params.bucketName
+ params.bucketName,
+ params.outName
);
const outputSize = fs.statSync(outfile);
@@ -459,7 +462,11 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
outputFile: {
lastModified: Date.now(),
size: outputSize.size,
- url: getOutputUrlFromMetadata(renderMetadata, params.bucketName),
+ url: getOutputUrlFromMetadata(
+ renderMetadata,
+ params.bucketName,
+ getCustomOutName({renderMetadata, customCredentials})
+ ),
},
});
await finalEncodingProgressProm;
diff --git a/packages/lambda/src/functions/progress.ts b/packages/lambda/src/functions/progress.ts
index 2fa1e0e5bc..1535c0edde 100644
--- a/packages/lambda/src/functions/progress.ts
+++ b/packages/lambda/src/functions/progress.ts
@@ -36,5 +36,6 @@ export const progressHandler = (
region: getCurrentRegionInFunction(),
memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
timeoutInMiliseconds: options.timeoutInMiliseconds,
+ customCredentials: lambdaParams.customS3Implementation ?? null,
});
};
diff --git a/packages/lambda/src/functions/still.ts b/packages/lambda/src/functions/still.ts
index e2d266d9ae..3bbf7529b5 100644
--- a/packages/lambda/src/functions/still.ts
+++ b/packages/lambda/src/functions/still.ts
@@ -27,6 +27,7 @@ import {formatCostsInfo} from './helpers/format-costs-info';
import {getBrowserInstance} from './helpers/get-browser-instance';
import {getCurrentArchitecture} from './helpers/get-current-architecture';
import {getCurrentRegionInFunction} from './helpers/get-current-region';
+import {getCustomOutName} from './helpers/get-custom-out-name';
import {getOutputUrlFromMetadata} from './helpers/get-output-url-from-metadata';
import {lambdaWriteFile} from './helpers/io';
import {validateComposition} from './helpers/validate-composition';
@@ -114,6 +115,7 @@ const innerStillHandler = async (
region: getCurrentRegionInFunction(),
renderId,
outName: lambdaParams.outName ?? undefined,
+ privacy: lambdaParams.privacy,
};
await lambdaWriteFile({
@@ -147,7 +149,8 @@ const innerStillHandler = async (
const {key, renderBucketName, customCredentials} = getExpectedOutName(
renderMetadata,
- bucketName
+ bucketName,
+ lambdaParams.outName
);
const {size} = await fs.promises.stat(outputPath);
@@ -176,7 +179,11 @@ const innerStillHandler = async (
});
return {
- output: getOutputUrlFromMetadata(renderMetadata, bucketName),
+ output: getOutputUrlFromMetadata(
+ renderMetadata,
+ bucketName,
+ getCustomOutName({customCredentials, renderMetadata})
+ ),
size,
bucketName,
estimatedPrice: formatCostsInfo(estimatedPrice),
diff --git a/packages/lambda/src/shared/aws-clients.ts b/packages/lambda/src/shared/aws-clients.ts
index a1bc60c96e..59d0faec89 100644
--- a/packages/lambda/src/shared/aws-clients.ts
+++ b/packages/lambda/src/shared/aws-clients.ts
@@ -74,12 +74,15 @@ export type ServiceMapping = {
servicequotas: ServiceQuotasClient;
};
-export type CustomCredentials = {
- accessKeyId: string;
- secretAccessKey: string;
+export type CustomCredentialsWithoutSensitiveData = {
endpoint: string;
};
+export type CustomCredentials = CustomCredentialsWithoutSensitiveData & {
+ accessKeyId: string | null;
+ secretAccessKey: string | null;
+};
+
export const getServiceClient = <T extends keyof ServiceMapping>({
region,
service,
@@ -125,11 +128,14 @@ export const getServiceClient = <T extends keyof ServiceMapping>({
if (customCredentials) {
_clients[key] = new Client({
- region,
- credentials: {
- accessKeyId: customCredentials.accessKeyId,
- secretAccessKey: customCredentials.secretAccessKey,
- },
+ region: 'us-east-1',
+ credentials:
+ customCredentials.accessKeyId && customCredentials.secretAccessKey
+ ? {
+ accessKeyId: customCredentials.accessKeyId,
+ secretAccessKey: customCredentials.secretAccessKey,
+ }
+ : undefined,
endpoint: customCredentials.endpoint,
});
} else {
diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.ts
index 96a7a70ecf..4d73f2f1ae 100644
--- a/packages/lambda/src/shared/constants.ts
+++ b/packages/lambda/src/shared/constants.ts
@@ -11,7 +11,10 @@ import type {VideoConfig} from 'remotion';
import type {ChunkRetry} from '../functions/helpers/get-retry-stats';
import type {EnhancedErrorInfo} from '../functions/helpers/write-lambda-error';
import type {AwsRegion} from '../pricing/aws-regions';
-import type {CustomCredentials} from './aws-clients';
+import type {
+ CustomCredentials,
+ CustomCredentialsWithoutSensitiveData,
+} from './aws-clients';
import type {DownloadBehavior} from './content-disposition-header';
import type {ExpensiveChunk} from './get-most-expensive-chunks';
import type {LambdaArchitecture} from './validate-architecture';
@@ -132,6 +135,14 @@ export type OutNameInput =
customS3Implementation?: CustomCredentials;
};
+export type OutNameInputWithoutCredentials =
+ | string
+ | {
+ bucketName: string;
+ key: string;
+ customS3Implementation?: CustomCredentialsWithoutSensitiveData;
+ };
+
export type OutNameOutput = {
renderBucketName: string;
key: string;
@@ -249,6 +260,7 @@ export type LambdaPayloads = {
bucketName: string;
renderId: string;
version: string;
+ customS3Implementation?: CustomCredentials;
};
renderer: {
concurrencyPerLambda: number;
@@ -330,7 +342,8 @@ export type RenderMetadata = {
lambdaVersion: string;
region: AwsRegion;
renderId: string;
- outName: OutNameInput | undefined;
+ outName: OutNameInputWithoutCredentials | undefined;
+ privacy: Privacy;
};
export type PostRenderData = {
diff --git a/packages/lambda/src/shared/validate-outname.ts b/packages/lambda/src/shared/validate-outname.ts
index c0c1b96e16..120347f08d 100644
--- a/packages/lambda/src/shared/validate-outname.ts
+++ b/packages/lambda/src/shared/validate-outname.ts
@@ -1,4 +1,4 @@
-import type {OutNameInput} from './constants';
+import type {OutNameInputWithoutCredentials} from './constants';
import {validateBucketName} from './validate-bucketname';
const validateS3Key = (s3Key: string) => {
@@ -17,7 +17,9 @@ const validateS3Key = (s3Key: string) => {
}
};
-export const validateOutname = (outName: OutNameInput | undefined | null) => {
+export const validateOutname = (
+ outName: OutNameInputWithoutCredentials | undefined | null
+) => {
if (typeof outName === 'undefined' || outName === null) {
return;
}
diff --git a/packages/lambda/src/test/unit/expected-out-name.test.ts b/packages/lambda/src/test/unit/expected-out-name.test.ts
index 2e8947c81f..4c1c4c343f 100644
--- a/packages/lambda/src/test/unit/expected-out-name.test.ts
+++ b/packages/lambda/src/test/unit/expected-out-name.test.ts
@@ -30,10 +30,11 @@ const testRenderMetadata: RenderMetadata = {
id: 'react-svg',
width: 1080,
},
+ privacy: 'public',
};
test('Should get a custom outname', () => {
- expect(getExpectedOutName(testRenderMetadata, bucketName)).toEqual({
+ expect(getExpectedOutName(testRenderMetadata, bucketName, null)).toEqual({
customCredentials: null,
renderBucketName: 'remotionlambda-98fsduf',
key: 'renders/9n8dsfafs/out.mp4',
@@ -48,7 +49,7 @@ test('Should save to a different outname', () => {
key: 'my-key',
},
};
- expect(getExpectedOutName(newRenderMetadata, bucketName)).toEqual({
+ expect(getExpectedOutName(newRenderMetadata, bucketName, null)).toEqual({
customCredentials: null,
renderBucketName: 'my-bucket',
key: 'my-key',
@@ -60,7 +61,7 @@ test('For stills', () => {
...testRenderMetadata,
type: 'still',
};
- expect(getExpectedOutName(newRenderMetadata, bucketName)).toEqual({
+ expect(getExpectedOutName(newRenderMetadata, bucketName, null)).toEqual({
customCredentials: null,
renderBucketName: 'remotionlambda-98fsduf',
key: 'renders/9n8dsfafs/out.png',
@@ -72,7 +73,7 @@ test('Just a custom name', () => {
...testRenderMetadata,
outName: 'justaname.jpeg',
};
- expect(getExpectedOutName(newRenderMetadata, bucketName)).toEqual({
+ expect(getExpectedOutName(newRenderMetadata, bucketName, null)).toEqual({
customCredentials: null,
renderBucketName: 'remotionlambda-98fsduf',
key: 'renders/9n8dsfafs/justaname.jpeg',
@@ -85,19 +86,32 @@ test('Should throw on invalid names', () => {
outName: '👺.jpeg',
};
expectToThrow(() => {
- expect(getExpectedOutName(newRenderMetadata, bucketName)).toEqual({
+ expect(getExpectedOutName(newRenderMetadata, bucketName, null)).toEqual({
customCredentials: null,
renderBucketName: 'remotionlambda-98fsduf',
key: 'renders/9n8dsfafs/justaname.jpeg',
});
}, /The S3 Key must match the RegExp/);
});
+
test('Should allow outName an outname with a slash', () => {
const newRenderMetadata: RenderMetadata = {
...testRenderMetadata,
outName: 'justa/name.jpeg',
};
- expect(getExpectedOutName(newRenderMetadata, bucketName)).toEqual({
+ expect(getExpectedOutName(newRenderMetadata, bucketName, null)).toEqual({
+ customCredentials: null,
+ key: 'renders/9n8dsfafs/justa/name.jpeg',
+ renderBucketName: 'remotionlambda-98fsduf',
+ });
+});
+
+test('Should allow to ', () => {
+ const newRenderMetadata: RenderMetadata = {
+ ...testRenderMetadata,
+ outName: 'justa/name.jpeg',
+ };
+ expect(getExpectedOutName(newRenderMetadata, bucketName, null)).toEqual({
customCredentials: null,
key: 'renders/9n8dsfafs/justa/name.jpeg',
renderBucketName: 'remotionlambda-98fsduf',
diff --git a/packages/lambda/src/test/unit/price-calculation.test.ts b/packages/lambda/src/test/unit/price-calculation.test.ts
index 916fbea8fb..92e407baf6 100644
--- a/packages/lambda/src/test/unit/price-calculation.test.ts
+++ b/packages/lambda/src/test/unit/price-calculation.test.ts
@@ -40,6 +40,7 @@ test('Should not throw while calculating prices when time shifts occur', () => {
defaultProps: {},
},
outName: 'out.mp4',
+ privacy: 'public',
},
outputFileMetadata: {
url: 'out.mp4',