Describe the problem/error/question
I have a workflow that when ever I open it in the editor - my main n8n node crashes. This happens everytime. The workflow itself does run though. I just can not edit it anymore.
What is the error message (if any)?
<--- Last few GCs ---> │
│ n8n │
│ n8n [10:0xffff7e3f0000] 66908 ms: Scavenge (reduce) (interleaved) 766.1 (774.9) -> 766.1 (773.9) MB, pooled: 0 MB, 68.23 / 0.00 ms (average mu = 0.708, current mu = 0.417) allocation failure; │
│ n8n [10:0xffff7e3f0000] 67211 ms: Mark-Compact (reduce) 767.1 (773.9) -> 766.9 (774.9) MB, pooled: 0 MB, 206.55 / 0.00 ms (+ 292.8 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 583 ms) (average m │
│ n8n │
│ n8n <--- JS stacktrace ---> │
│ n8n │
│ n8n FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory │
│ n8n ----- Native stack trace -----
Please share your workflow
(Select the nodes on your canv{
"name": "Put Knack Data into Database V3",
"nodes": [
{
"parameters": {
"url": "=https://api.knack.com/v1/objects/{{ $json.object_id }}/records",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "page",
"value": "={{ $json.page }}"
},
{
"name": "rows_per_page",
"value": "500"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "X-Knack-Application-Id",
"value": "={{ $('Constants').first().json.knack_application_id }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-224,
0
],
"id": "7c6a53a8-cd4a-4616-b8d8-01254bd729e8",
"name": "HTTP Request",
"credentials": {
"httpHeaderAuth": {
"id": "9F7gk4ZD2gTUg1ul",
"name": "Knack API Key"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "a635ac5f-de16-4238-ac42-d8ba55aa3cae",
"leftValue": "={{ $json.done }}",
"rightValue": 3,
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
1120,
80
],
"id": "0d815b6e-38ac-43a0-9d20-8ba1048ccfbe",
"name": "If"
},
{
"parameters": {
"workflowInputs": {
"values": [
{
"name": "object_id"
},
{
"name": "salesforce_key_field"
}
]
}
},
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1.1,
"position": [
-672,
80
],
"id": "ab905899-ffb1-4508-8e3e-b0eab449e5ca",
"name": "When Executed by Another Workflow"
},
{
"parameters": {
"jsCode": "const first = $input.first().json.total_pages === undefined;\n\nif (first) {\n return {\n knack_application_id: \"5db0ba667dcfde0015d264cc\",\n done: false,\n object_id: $input.first().json.object_id,\n salesforce_key_field: $input.first().json.salesforce_key_field,\n page: 1,\n total_pages: -1,\n }\n} else {\n return {\n knack_application_id: \"5db0ba667dcfde0015d264cc\",\n done: $input.first().json.done,\n object_id: $input.first().json.object_id,\n salesforce_key_field: $input.first().json.salesforce_key_field,\n page: $input.first().json.page,\n total_pages: $input.first().json.total_pages,\n }\n}"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-448,
80
],
"id": "14d7b977-aceb-4056-83df-8c174bbba0ed",
"name": "Constants"
},
{
"parameters": {
"jsCode": "return {\n knack_application_id: $(\"Constants\").first().json.knack_application_id,\n done: $('HTTP Request').first().json.total_records === 0 || $('HTTP Request').first().json.total_pages === $('HTTP Request').first().json.current_page,\n object_id: $(\"Constants\").first().json.object_id,\n salesforce_key_field: $(\"Constants\").first().json.salesforce_key_field,\n page: $('HTTP Request').first().json.current_page + 1,\n total_pages: $('HTTP Request').first().json.total_pages,\n}\n\n/*return {\n knack_application_id: $(\"Constants\").first().json.knack_application_id,\n done: $('HTTP Request').first().json.current_page >= 3,\n object_id: $(\"Constants\").first().json.object_id,\n salesforce_key_field: $(\"Constants\").first().json.salesforce_key,\n page: $('HTTP Request').first().json.current_page + 1,\n total_pages: $('HTTP Request').first().json.total_pages,\n}*/"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
672,
0
],
"id": "7d193de6-3764-4c7e-baae-cc8d27708299",
"name": "Variables"
},
{
"parameters": {
"amount": 1
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
896,
0
],
"id": "b920280f-f9cf-45c6-bddc-4612bc35e163",
"name": "Wait",
"webhookId": "8fdef8d8-9b8d-4ae0-8b8e-4268cad9c1cd"
},
{
"parameters": {},
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
1344,
80
],
"id": "4abaa29c-d225-4a43-af82-d5294931bf2b",
"name": "No Operation, do nothing"
},
{
"parameters": {
"fieldToSplitOut": "=records",
"options": {}
},
"type": "n8n-nodes-base.splitOut",
"typeVersion": 1,
"position": [
0,
0
],
"id": "289901be-f68b-46e0-97ae-131e123e8364",
"name": "Split Out"
},
{
"parameters": {
"operation": "executeQuery",
"query": "INSERT INTO knack_rows (object_type, knack_id, salesforce_key, object)\nVALUES ($1, $2, $3, $4) AS new_values\nON DUPLICATE KEY UPDATE \n salesforce_key = new_values.salesforce_key,\n object = new_values.object;",
"options": {
"queryReplacement": "={{ $('Constants').first().json.object_id }},id_{{ $json.id }},{{ $json.salesforce_key }},{{ $json.encoded }}"
}
},
"type": "n8n-nodes-base.mySql",
"typeVersion": 2.5,
"position": [
448,
0
],
"id": "647b1d3d-c83b-4d5f-9616-20d33b439fa4",
"name": "Execute a SQL query",
"credentials": {
"mySql": {
"id": "k7BSvTvn8vHOYWnc",
"name": "BDR Portal"
}
}
},
{
"parameters": {
"jsCode": "// Base64 Chunking Function for n8n JavaScript Node\n// Copy this entire code into your n8n JavaScript node\n\n// Configuration\nconst chunkSize = 1048576; // 1MB chunks (adjust based on your needs)\n\n// Function to encode large strings in chunks\nfunction encodeInChunks(str, chunkSizeBytes) {\n if (!str || str.length === 0) {\n return '';\n }\n \n // Convert string to Buffer\n const buffer = Buffer.from(str, 'utf8');\n \n // For proper base64 encoding, process in multiples of 3 bytes\n // This prevents padding issues at chunk boundaries\n const adjustedChunkSize = Math.floor(chunkSizeBytes / 4) * 3;\n \n // If the string is small enough, encode it directly\n if (buffer.length <= adjustedChunkSize) {\n return buffer.toString('base64');\n }\n \n // Process in chunks\n const encodedChunks = [];\n let offset = 0;\n \n while (offset < buffer.length) {\n const end = Math.min(offset + adjustedChunkSize, buffer.length);\n const chunk = buffer.slice(offset, end);\n encodedChunks.push(chunk.toString('base64'));\n offset = end;\n }\n \n // Combine all chunks into final base64 string\n return encodedChunks.join('');\n}\n\n\n\n\nconst ret = [];\n\nfor (const item of $input.all()) {\n // Perform the encoding\n let encodedResult = '';\n let error = null;\n\n const str = JSON.stringify(item.json);\n \n try {\n encodedResult = encodeInChunks(str, chunkSize);\n } catch (e) {\n error = e.message;\n }\n \n let obj = {};\n if (error) {\n obj = {\n json: {\n success: false,\n error: error\n }\n };\n } else {\n obj = {\n json: {\n success: true,\n id: item.json.id,\n salesforce_key: item.json[ $('Constants').first().json.salesforce_key_field],\n encoded: encodedResult,\n originalLength: str ? str.length : 0,\n encodedLength: encodedResult.length,\n compressionRatio: str ? (encodedResult.length / str.length * 100).toFixed(1) + '%' : 'N/A'\n }\n };\n }\n ret.push(obj);\n}\n\nreturn ret;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
224,
0
],
"id": "b5302c49-b8ec-4951-8f0b-30e57412b615",
"name": "Code in JavaScript"
}
],
"pinData": {
"When Executed by Another Workflow": [
{
"json": {
"object_id": "object_13",
"salesforce_key_field": "field_390"
}
}
]
},
"connections": {
"HTTP Request": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
],
[
{
"node": "Constants",
"type": "main",
"index": 0
}
]
]
},
"When Executed by Another Workflow": {
"main": [
[
{
"node": "Constants",
"type": "main",
"index": 0
}
]
]
},
"Constants": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"Variables": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Wait": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Execute a SQL query": {
"main": [
[
{
"node": "Variables",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "Execute a SQL query",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1",
"callerPolicy": "workflowsFromSameOwner",
"availableInMCP": false,
"errorWorkflow": "TFFfLpj5EI57sn30"
},
"versionId": "c399782d-69d4-4fd9-b8b8-25b2a3f7b7d8",
"meta": {
"instanceId": "9a3c7f0bfed66e0fd51b9630d5ba507bfc631c3fa8f5a9edd7ca194c0a41eb45"
},
"id": "nFKdW3jqmbuWKMyg",
"tags": []
}as and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
- n8n version: 1.120.4
- Database (default: SQLite): postgres
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker (k8s)
- Operating system: