chore(server): bump logic-function executor lambda memory to 512MB (#19826)

## 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)
This commit is contained in:
Charles Bochet
2026-04-17 23:59:05 +02:00
committed by GitHub
parent fb5a1988b1
commit e878d646ed
@@ -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 },
};