Skip to content

🎥 Make videos programmatically with React

`@remotion/lambda`: Fix skipLambdaInvocation flag

Jonny Burger4a660e8bf786
diff --git a/packages/lambda/src/functions/helpers/calculate-price-from-bucket.ts b/packages/lambda/src/functions/helpers/calculate-price-from-bucket.ts
index c61baadc4a..cb63802d1f 100644
--- a/packages/lambda/src/functions/helpers/calculate-price-from-bucket.ts
+++ b/packages/lambda/src/functions/helpers/calculate-price-from-bucket.ts
@@ -1,4 +1,4 @@
-import type {CloudProvider, ProviderSpecifics} from '@remotion/serverless';
+import type {CloudProvider} from '@remotion/serverless';
import type {RenderMetadata} from '@remotion/serverless/client';
import {estimatePrice} from '../../api/estimate-price';
import type {AwsRegion} from '../../regions';
@@ -11,14 +11,14 @@ export const estimatePriceFromBucket = <Provider extends CloudProvider>({
diskSizeInMb,
lambdasInvoked,
timings,
- providerSpecifics,
+ region,
}: {
renderMetadata: RenderMetadata<Provider> | null;
memorySizeInMb: number;
diskSizeInMb: number;
lambdasInvoked: number;
timings: ParsedTiming[];
- providerSpecifics: ProviderSpecifics<Provider>;
+ region: AwsRegion;
}) => {
if (!renderMetadata) {
return null;
@@ -45,7 +45,7 @@ export const estimatePriceFromBucket = <Provider extends CloudProvider>({
const accruedSoFar = Number(
estimatePrice({
- region: providerSpecifics.getCurrentRegionInFunction() as AwsRegion,
+ region,
durationInMilliseconds: estimatedBillingDurationInMilliseconds,
memorySizeInMb,
diskSizeInMb,
diff --git a/packages/lambda/src/functions/helpers/get-progress.ts b/packages/lambda/src/functions/helpers/get-progress.ts
index 988c248766..11af07b792 100644
--- a/packages/lambda/src/functions/helpers/get-progress.ts
+++ b/packages/lambda/src/functions/helpers/get-progress.ts
@@ -10,6 +10,7 @@ import {
type CustomCredentials,
} from '@remotion/serverless/client';
import {NoReactInternals} from 'remotion/no-react';
+import type {AwsRegion} from '../../regions';
import type {CleanupInfo, GenericRenderProgress} from '../../shared/constants';
import {MAX_EPHEMERAL_STORAGE_IN_MB} from '../../shared/constants';
import {calculateChunkTimes} from './calculate-chunk-times';
@@ -209,7 +210,7 @@ export const getProgress = async <Provider extends CloudProvider>({
// overestimate the price, but will only have a miniscule effect (~0.2%)
diskSizeInMb: MAX_EPHEMERAL_STORAGE_IN_MB,
timings: overallProgress.timings ?? [],
- providerSpecifics,
+ region: region as AwsRegion,
});
const chunkMultiplier = [hasAudio, hasVideo].filter(truthy).length;
diff --git a/packages/lambda/src/test/unit/price-calculation.test.ts b/packages/lambda/src/test/unit/price-calculation.test.ts
index 409ab6225c..1fd46bf2b4 100644
--- a/packages/lambda/src/test/unit/price-calculation.test.ts
+++ b/packages/lambda/src/test/unit/price-calculation.test.ts
@@ -1,6 +1,5 @@
import {expect, test} from 'vitest';
import {estimatePriceFromBucket} from '../../functions/helpers/calculate-price-from-bucket';
-import {mockImplementation} from '../mock-implementation';
test('Should not throw while calculating prices when time shifts occur', () => {
const aDate = Date.now();
@@ -54,7 +53,7 @@ test('Should not throw while calculating prices when time shifts occur', () => {
start: aDate,
},
],
- providerSpecifics: mockImplementation,
+ region: 'eu-central-1',
});
expect(price?.accruedSoFar).toBeGreaterThanOrEqual(0);
});