Rename serverlessFunction to logicFunction (#17494)

## Summary

Rename "Serverless Function" to "Logic Function" across the codebase for
clearer naming.

### Environment Variable Changes

| Old | New |
|-----|-----|
| `SERVERLESS_TYPE` | `LOGIC_FUNCTION_TYPE` |
| `SERVERLESS_LAMBDA_REGION` | `LOGIC_FUNCTION_LAMBDA_REGION` |
| `SERVERLESS_LAMBDA_ROLE` | `LOGIC_FUNCTION_LAMBDA_ROLE` |
| `SERVERLESS_LAMBDA_SUBHOSTING_URL` |
`LOGIC_FUNCTION_LAMBDA_SUBHOSTING_URL` |
| `SERVERLESS_LAMBDA_ACCESS_KEY_ID` |
`LOGIC_FUNCTION_LAMBDA_ACCESS_KEY_ID` |
| `SERVERLESS_LAMBDA_SECRET_ACCESS_KEY` |
`LOGIC_FUNCTION_LAMBDA_SECRET_ACCESS_KEY` |

### Breaking Changes

- Environment variables must be updated in production deployments
- Database migration renames `serverlessFunction` → `logicFunction`
tables
This commit is contained in:
Charles Bochet
2026-01-28 01:42:19 +01:00
committed by GitHub
parent 59d123d2b1
commit da6f1bbef3
351 changed files with 5054 additions and 5139 deletions
@@ -135,7 +135,7 @@ You can attach files to emails sent from workflows. The attachment is a static f
| **Event confirmations** | Event details or agenda |
<Note>
Attachments are static—the same file is sent to all recipients. For dynamic documents (like personalized quotes), generate and attach files using a [Serverless Function](/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty).
Attachments are static—the same file is sent to all recipients. For dynamic documents (like personalized quotes), generate and attach files using a [Logic Function](/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty).
</Note>
## Best Practices
@@ -215,7 +215,7 @@ Runs custom JavaScript within your workflow.
- Test code directly in the step
<Note>
If you need to use external API keys in your code, you must input them directly in the function body. You cannot configure API keys elsewhere and reference them in the serverless function.
If you need to use external API keys in your code, you must input them directly in the function body. You cannot configure API keys elsewhere and reference them in the logic function.
</Note>
<Tip>
@@ -7,7 +7,7 @@ Automatically generate or fetch a PDF and attach it to a record in Twenty. This
## Overview
This workflow uses a **Manual Trigger** so users can generate a PDF on demand for any selected record. A **Serverless Function** handles:
This workflow uses a **Manual Trigger** so users can generate a PDF on demand for any selected record. A **Logic Function** handles:
1. Downloading the PDF from a URL (from a PDF generation service)
2. Uploading the file to Twenty
3. Creating an Attachment linked to the record
@@ -16,7 +16,7 @@ This workflow uses a **Manual Trigger** so users can generate a PDF on demand fo
Before setting up the workflow:
1. **Create an API Key**: Go to **Settings → APIs** and create a new API key. You'll need this token for the serverless function.
1. **Create an API Key**: Go to **Settings → APIs** and create a new API key. You'll need this token for the logic function.
2. **Set up a PDF generation service** (optional): If you want to dynamically generate PDFs (e.g., quotes), use a service like Carbone, PDFMonkey, or DocuSeal to create the PDF and get a download URL.
## Step-by-Step Setup
@@ -31,9 +31,9 @@ Before setting up the workflow:
With a Manual Trigger, users can run this workflow using a button that appears on the top right once a record is selected, to generate and attach a PDF.
</Tip>
### Step 2: Add a Serverless Function
### Step 2: Add a Logic Function
1. Add a **Serverless Function** action
1. Add a **Code** action (logic function)
2. Create a new function with the code below
3. Configure the input parameters
@@ -44,10 +44,10 @@ With a Manual Trigger, users can run this workflow using a button that appears o
| `companyId` | `{{trigger.object.id}}` |
<Note>
If attaching to a different object (Person, Opportunity, etc.), rename the parameter accordingly (e.g., `personId`, `opportunityId`) and update the serverless function.
If attaching to a different object (Person, Opportunity, etc.), rename the parameter accordingly (e.g., `personId`, `opportunityId`) and update the logic function.
</Note>
#### Serverless Function Code
#### Logic Function Code
```typescript
export const main = async (
@@ -170,7 +170,7 @@ Update both the function parameter and the `variables.data` object in the attach
If using a PDF generation service, you can:
1. First make an HTTP Request action to generate the PDF
2. Pass the returned PDF URL to the serverless function as a parameter
2. Pass the returned PDF URL to the logic function as a parameter
```typescript
export const main = async (
@@ -209,7 +209,7 @@ For creating dynamic quotes or invoices:
- **DocuSeal** - Document automation platform
- **Documint** - API-first document generation
Each service provides an API that returns a PDF URL, which you can then pass to the serverless function.
Each service provides an API that returns a PDF URL, which you can then pass to the logic function.
## Troubleshooting
@@ -222,6 +222,6 @@ Each service provides an API that returns a PDF URL, which you can then pass to
## Related
- [Workflow Triggers](/user-guide/workflows/capabilities/workflow-triggers)
- [Serverless Functions](/user-guide/workflows/capabilities/workflow-actions#serverless-function)
- [Logic Functions](/user-guide/workflows/capabilities/workflow-actions#code)
- [Generate a Quote or Invoice from Twenty](/user-guide/workflows/how-tos/connect-to-other-tools/generate-quote-or-invoice-from-twenty)
@@ -125,7 +125,7 @@ description: Frequently asked questions about workflows in Twenty.
</Accordion>
<Accordion title="What's the maximum execution time for Code actions?">
Code actions (serverless functions) have a **default timeout of 5 minutes** (300 seconds).
Code actions (logic functions) have a **default timeout of 5 minutes** (300 seconds).
The maximum configurable timeout is **15 minutes** (900 seconds).