Skip to content

🎥 Make videos programmatically with React

Keep Lambda props byte-counting PR focused

Jonny Burger10656d80004f
diff --git a/packages/lambda-client/src/get-compositions-on-lambda.ts b/packages/lambda-client/src/get-compositions-on-lambda.ts
index 6c00e261a9..60042ef77e 100644
--- a/packages/lambda-client/src/get-compositions-on-lambda.ts
+++ b/packages/lambda-client/src/get-compositions-on-lambda.ts
@@ -67,7 +67,7 @@ export const getCompositionsOnLambda = async ({
type: 'video-or-audio',
sizes: [
getSizeInBytes(stringifiedInputProps),
- getSizeInBytes(JSON.stringify(envVariables ?? {})),
+ getSizeInBytes(JSON.stringify(envVariables)),
],
providerSpecifics: awsImplementation,
}),
@@ -86,7 +86,7 @@ export const getCompositionsOnLambda = async ({
type: ServerlessRoutines.compositions,
chromiumOptions: chromiumOptions ?? {},
serveUrl,
- envVariables: envVariables ?? {},
+ envVariables,
inputProps: serializedInputProps,
logLevel: dumpBrowserLogs ? 'verbose' : (logLevel ?? 'info'),
timeoutInMilliseconds: timeoutInMilliseconds ?? 30000,
diff --git a/packages/lambda-client/src/test/get-compositions-on-lambda.test.ts b/packages/lambda-client/src/test/get-compositions-on-lambda.test.ts
deleted file mode 100644
index 9bd1d36fa5..0000000000
--- a/packages/lambda-client/src/test/get-compositions-on-lambda.test.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import {expect, spyOn, test} from 'bun:test';
-import {awsImplementation} from '../aws-provider';
-import {getCompositionsOnLambda} from '../get-compositions-on-lambda';
-
-test('defaults envVariables to {} when they are omitted', async () => {
- const callFunctionSync = spyOn(
- awsImplementation,
- 'callFunctionSync',
- ).mockResolvedValue({type: 'success', compositions: []} as never);
- try {
- await getCompositionsOnLambda({
- region: 'us-east-1',
- functionName: 'remotion-render-test',
- serveUrl: 'https://example.com',
- inputProps: {},
- });
-
- expect(callFunctionSync).toHaveBeenCalledTimes(1);
- expect(callFunctionSync.mock.calls[0][0].payload).toHaveProperty(
- 'envVariables',
- {},
- );
- } finally {
- callFunctionSync.mockRestore();
- }
-});
diff --git a/packages/serverless-client/src/test/validate-webhook.test.ts b/packages/serverless-client/src/test/validate-webhook.test.ts
deleted file mode 100644
index 9c2bcf2229..0000000000
--- a/packages/serverless-client/src/test/validate-webhook.test.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import {expect, test} from 'bun:test';
-import {validateWebhook} from '../validate-webhook';
-
-test('rejects customData over 1024 bytes even if under 1024 characters', () => {
- expect(() =>
- validateWebhook({
- url: 'https://example.com/webhook',
- secret: null,
- customData: {text: 'å­—'.repeat(500)},
- }),
- ).toThrow(
- 'Webhook "customData" must be less than 1024 bytes. Current size: 1511 bytes.',
- );
-});
diff --git a/packages/serverless-client/src/validate-webhook.ts b/packages/serverless-client/src/validate-webhook.ts
index d770445883..f400d049d5 100644
--- a/packages/serverless-client/src/validate-webhook.ts
+++ b/packages/serverless-client/src/validate-webhook.ts
@@ -1,5 +1,4 @@
import type {WebhookOption} from './constants';
-import {getSizeInBytes} from './get-size-in-bytes';
export const MAX_WEBHOOK_CUSTOM_DATA_SIZE = 1024;
@@ -9,7 +8,7 @@ export const validateWebhook = (webhook?: WebhookOption | null) => {
}
if (webhook.customData) {
- const size = getSizeInBytes(JSON.stringify(webhook.customData));
+ const size = JSON.stringify(webhook.customData).length;
if (size > MAX_WEBHOOK_CUSTOM_DATA_SIZE) {
throw new Error(
`Webhook "customData" must be less than ${MAX_WEBHOOK_CUSTOM_DATA_SIZE} bytes. Current size: ${size} bytes.`,