Skip to content

Commit

Permalink
@remotion/lambda: Skip PutBucketAcl if --privacy=no-acl was passed
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyBurger committed Dec 12, 2024
1 parent 94afc62 commit ee47c0c
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/lambda/src/api/get-compositions-on-lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const getCompositionsOnLambda = async ({
]),
providerSpecifics: awsImplementation,
forcePathStyle: forcePathStyle ?? false,
skipPutAcl: false,
});

try {
Expand Down
1 change: 1 addition & 0 deletions packages/lambda/src/api/get-or-create-bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export const getOrCreateBucket = (
customCredentials: options.customCredentials ?? null,
providerSpecifics: awsImplementation,
forcePathStyle: false,
skipPutAcl: false,
});
};
2 changes: 2 additions & 0 deletions packages/lambda/src/api/make-lambda-payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export const makeLambdaRenderMediaPayload = async ({
propsType: 'input-props',
providerSpecifics: awsImplementation,
forcePathStyle: forcePathStyle ?? false,
skipPutAcl: privacy === 'no-acl',
});
return {
rendererFunctionName,
Expand Down Expand Up @@ -272,6 +273,7 @@ export const makeLambdaRenderStillPayload = async ({
propsType: 'input-props',
providerSpecifics: awsImplementation,
forcePathStyle,
skipPutAcl: privacy === 'no-acl',
});

return {
Expand Down
1 change: 1 addition & 0 deletions packages/lambda/src/cli/commands/sites/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export const sitesCreateSubcommand = async (
customCredentials: null,
providerSpecifics: implementation,
forcePathStyle: false,
skipPutAcl: parsedLambdaCli.privacy === 'no-acl',
})
).bucketName;

Expand Down
1 change: 1 addition & 0 deletions packages/lambda/src/cli/commands/sites/rm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const sitesRmSubcommand = async (
customCredentials: null,
providerSpecifics: implementation,
forcePathStyle: false,
skipPutAcl: false,
})
).bucketName;

Expand Down
1 change: 1 addition & 0 deletions packages/lambda/src/cli/commands/sites/rmall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const sitesRmallSubcommand = async (
customCredentials: null,
providerSpecifics: implementation,
forcePathStyle: false,
skipPutAcl: false,
})
).bucketName;

Expand Down
1 change: 1 addition & 0 deletions packages/lambda/src/functions/launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ const innerLaunchHandler = async <Provider extends CloudProvider>({
needsToUpload,
providerSpecifics,
forcePathStyle: params.forcePathStyle,
skipPutAcl: false,
});

registerCleanupTask(() => {
Expand Down
1 change: 1 addition & 0 deletions packages/lambda/src/functions/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const startHandler = async <Provider extends CloudProvider>(
customCredentials: null,
providerSpecifics,
forcePathStyle: params.forcePathStyle,
skipPutAcl: false,
})
).bucketName;
const realServeUrl = providerSpecifics.convertToServeUrl({
Expand Down
1 change: 1 addition & 0 deletions packages/lambda/src/functions/still.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const innerStillHandler = async <Provider extends CloudProvider>(
customCredentials: null,
providerSpecifics,
forcePathStyle: lambdaParams.forcePathStyle,
skipPutAcl: false,
}).then((b) => b.bucketName);

const outputDir = RenderInternals.tmpDir('remotion-render-');
Expand Down
2 changes: 2 additions & 0 deletions packages/lambda/src/test/integration/delete-site.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ test('Return 0 total size if site did not exist', async () => {
customCredentials: null,
enableFolderExpiry: null,
forcePathStyle: false,
skipPutAcl: false,
});
expect(
await internalDeleteSite({
Expand All @@ -30,6 +31,7 @@ test('Return more than 0 total size if site did not exist', async () => {
customCredentials: null,
enableFolderExpiry: null,
forcePathStyle: false,
skipPutAcl: false,
});
const {siteName} = await internalDeploySite({
bucketName,
Expand Down
5 changes: 5 additions & 0 deletions packages/lambda/src/test/integration/deploy-site.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ test('Should apply name if given', async () => {
customCredentials: null,
enableFolderExpiry: false,
forcePathStyle: false,
skipPutAcl: false,
});
expect(
await internalDeploySite({
Expand Down Expand Up @@ -106,6 +107,7 @@ test('Should overwrite site if given siteName is already taken', async () => {
customCredentials: null,
enableFolderExpiry: false,
forcePathStyle: false,
skipPutAcl: false,
});

expect(
Expand Down Expand Up @@ -142,6 +144,7 @@ test('Should delete the previous site if deploying the new one', async () => {
customCredentials: null,
enableFolderExpiry: false,
forcePathStyle: false,
skipPutAcl: false,
});

await internalDeploySite({
Expand Down Expand Up @@ -199,6 +202,7 @@ test('Should keep the previous site if deploying the new one with different ID',
customCredentials: null,
enableFolderExpiry: false,
forcePathStyle: false,
skipPutAcl: false,
});

await internalDeploySite({
Expand Down Expand Up @@ -276,6 +280,7 @@ test('Should not delete site with same prefix', async () => {
customCredentials: null,
enableFolderExpiry: false,
forcePathStyle: false,
skipPutAcl: false,
});

await internalDeploySite({
Expand Down
1 change: 1 addition & 0 deletions packages/lambda/src/test/integration/get-sites.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ test('Should have a site after deploying', async () => {
customCredentials: null,
enableFolderExpiry: null,
forcePathStyle: false,
skipPutAcl: false,
});
expect(
await internalDeploySite({
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/compositions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const compositionsHandler = async <Provider extends CloudProvider>(
customCredentials: null,
providerSpecifics,
forcePathStyle: lambdaParams.forcePathStyle,
skipPutAcl: false,
}).then((b) => b.bucketName);

const bucketName = await bucketNamePromise;
Expand Down
3 changes: 3 additions & 0 deletions packages/serverless/src/compress-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const compressInputProps = async <Provider extends CloudProvider>({
needsToUpload,
providerSpecifics,
forcePathStyle,
skipPutAcl,
}: {
stringifiedInputProps: string;
region: Provider['region'];
Expand All @@ -76,6 +77,7 @@ export const compressInputProps = async <Provider extends CloudProvider>({
needsToUpload: boolean;
providerSpecifics: ProviderSpecifics<Provider>;
forcePathStyle: boolean;
skipPutAcl: boolean;
}): Promise<SerializedInputProps> => {
const hash = providerSpecifics.randomHash();

Expand All @@ -89,6 +91,7 @@ export const compressInputProps = async <Provider extends CloudProvider>({
customCredentials: null,
providerSpecifics,
forcePathStyle,
skipPutAcl,
})
).bucketName;

Expand Down
2 changes: 2 additions & 0 deletions packages/serverless/src/get-or-create-bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type GetOrCreateBucketInputInner<Provider extends CloudProvider> = {
customCredentials: CustomCredentials<Provider> | null;
providerSpecifics: ProviderSpecifics<Provider>;
forcePathStyle: boolean;
skipPutAcl: boolean;
};

export type GetOrCreateBucketInput<Provider extends CloudProvider> = {
Expand Down Expand Up @@ -63,6 +64,7 @@ export const internalGetOrCreateBucket = async <Provider extends CloudProvider>(
bucketName,
region: params.region,
forcePathStyle: params.forcePathStyle,
skipPutAcl: params.skipPutAcl,
});

// apply to newly created bucket
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/provider-implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type CreateBucket<Provider extends CloudProvider> = (params: {
region: Provider['region'];
bucketName: string;
forcePathStyle: boolean;
skipPutAcl: boolean;
}) => Promise<void>;

type ApplyLifeCycle<Provider extends CloudProvider> = (params: {
Expand Down

0 comments on commit ee47c0c

Please sign in to comment.