Describe the problem/error/question
I have a Code node in my workflow that simply defines a static JavaScript object and returns it.
const userData = {
"name": "Hans-Christian",
"firstName": "Hans",
"lastName": "Rørby",
"fullName": "Hans-Christian Rørby",
"email": "[email protected]",
"userRole": "account",
"userPermissions": "admin",
"whiteLabelUrl": "hans.com",
"relationshipId": "1-234-567",
"agencyName": "Hans' Door Knob Cleaner",
"currentUrl": "https://hans.com/reports",
"locationId": "sfsaf3feasfckascnmi930",
"locationName": "Hans' Cleaner",
"knowledgeRoot": "https://hans.com.knowledgebases.net",
"platformVersion": "v2",
"lc_enabled": "true",
"accountId": "3r3ffsarfe33",
"kbSpaceId": "f33afasdfasfa",
"apiBaseUrl": "https://hans.apiUrl"
}
return [userData];
When I run this workflow in production mode, this specific Code node consistently takes around 1500ms to execute, as shown in the execution logs.
When I test the workflow manually:
The first time I execute the node (or the workflow containing it after a period of inactivity), this Code node also takes approximately 1500ms.
On subsequent manual test executions (without waiting a long time), the same Code node executes very quickly, around 7ms, which is what I would expect.
This significant delay on the first run (both in production and during initial testing) for such a simple operation seems excessive. I understand there can be cold start overheads, but 1.5 seconds for defining an object feels like there might be something else at play or an opportunity for optimization within n8n’s Code node handling.
Is this expected behavior for a Code node on its first execution after a “cold” state? If so, what contributes to this long initialization time for a simple object definition? If not, what could be causing this?
Please share your workflow
Share the output returned by the last node
[
{
“name”: “Hans-Christian”,
“firstName”: “Hans”,
“lastName”: “Rørby”,
“fullName”: “Hans-Christian Rørby”,
“email”: “[email protected]”,
“userRole”: “account”,
“userPermissions”: “admin”,
“whiteLabelUrl”: “hans.com”,
“relationshipId”: “1-234-567”,
“agencyName”: “Hans’ Door Knob Cleaner”,
“currentUrl”: “https://hans.com/reports”,
“locationId”: “sfsaf3feasfckascnmi930”,
“locationName”: “Hans’ Cleaner”,
“knowledgeRoot”: “https://hans.com.knowledgebases.net”,
“platformVersion”: “v2”,
“lc_enabled”: “true”,
“accountId”: “3r3ffsarfe33”,
“kbSpaceId”: “f33afasdfasfa”,
“apiBaseUrl”: “https://hans.apiUrl”
}
]
Information on your n8n setup
- n8n version: 1.90.2
- Database (default: SQLite): n8n Cloud managed, so the default I guess.
- n8n EXECUTIONS_PROCESS setting (default: own, main): n8n Cloud managed, so the default I guess.
- Running n8n via (Docker, npm, n8n cloud, desktop app): Cloud
- Operating system: We are on Cloud.