From e878d646ed05043f1f2bff44f55f956fa3e502c7 Mon Sep 17 00:00:00 2001 From: Charles Bochet Date: Fri, 17 Apr 2026 23:59:05 +0200 Subject: [PATCH] chore(server): bump logic-function executor lambda memory to 512MB (#19826) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary The executor lambda for user logic functions is created in `LambdaDriver` without a `MemorySize` parameter, so AWS Lambda falls back to its 128 MB default. That cap is too tight for non-trivial logic functions — large upstream GraphQL responses, JSON parsing of paginated batches, and chained Twenty Core API mutations push the process over the limit and trigger an OOM SIGKILL surfaced to the user as: ``` Runtime exited with error: signal: killed ``` This bumps the executor lambda memory to **512 MB** (matching the existing `BUILDER_LAMBDA_MEMORY_MB`). The change is applied on both: - The `CreateFunctionCommand` path used when a logic function is first deployed. - The `UpdateFunctionConfigurationCommand` path used when the deps/SDK layer wiring is refreshed — so existing functions get reconfigured on next deploy without any additional manual action. ## Why 512 MB Lambda compute is allocated proportionally to memory. 512 MB: - Matches the builder lambda already in this file (`BUILDER_LAMBDA_MEMORY_MB`). - Is comfortably above the 128 MB default that the existing OOMs are hitting. - Stays well below the higher tiers, keeping the per-invocation cost increase modest. Made with [Cursor](https://cursor.com) --- .../logic-function-drivers/drivers/lambda.driver.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/twenty-server/src/engine/core-modules/logic-function/logic-function-drivers/drivers/lambda.driver.ts b/packages/twenty-server/src/engine/core-modules/logic-function/logic-function-drivers/drivers/lambda.driver.ts index 808e03a6df..28afa5ea56 100644 --- a/packages/twenty-server/src/engine/core-modules/logic-function/logic-function-drivers/drivers/lambda.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/logic-function/logic-function-drivers/drivers/lambda.driver.ts @@ -65,6 +65,7 @@ const YARN_INSTALL_LAMBDA_MEMORY_MB = 1024; const COMMON_LAYER_NAME_PREFIX = 'twenty-common-layer'; const BUILDER_LAMBDA_TIMEOUT_SECONDS = 60; const BUILDER_LAMBDA_MEMORY_MB = 512; +const EXECUTOR_LAMBDA_MEMORY_MB = 512; const LAMBDA_EPHEMERAL_STORAGE_MB = 4096; const YARN_INSTALL_HANDLER_PATH = resolve( __dirname, @@ -917,6 +918,7 @@ export class LambdaDriver implements LogicFunctionDriver { Layers: [depsLayerArn, sdkLayerArn], Runtime: flatLogicFunction.runtime, Timeout: 900, + MemorySize: EXECUTOR_LAMBDA_MEMORY_MB, }), ); } @@ -1090,6 +1092,7 @@ export class LambdaDriver implements LogicFunctionDriver { Role: this.options.lambdaRole, Runtime: flatLogicFunction.runtime, Timeout: 900, + MemorySize: EXECUTOR_LAMBDA_MEMORY_MB, EphemeralStorage: { Size: LAMBDA_EPHEMERAL_STORAGE_MB }, };