Describe the problem/error/question:
I am running the RAG template from Cole Medin which creates a supabase RAG database. Although the template is running as expected. I get a “Connection Lost - You have a connection issue or the server is down” each and every time exactly at the Supabase vector store Node during the insert operation.
I am trying to insert a large PDF file of 2.41 MB containing 717 pages and 160,103 words.
What is the error message (if any)?
“Connection Lost - You have a connection issue or the server is down”
Please share your workflow
{
“nodes”: [
{
“parameters”: {
“jsonMode”: “expressionData”,
“jsonData”: “={{ $json.data || $json.text || $json.concatenated_data }}”,
“options”: {
“metadata”: {
“metadataValues”: [
{
“name”: “=file_id”,
“value”: “={{ $(‘Set File ID’).first().json.file_id }}”
},
{
“name”: “file_title”,
“value”: “={{ $(‘Set File ID’).first().json.file_title }}”
}
]
}
}
},
“id”: “4f3ddd07-13bb-4cae-a300-dcc0236016ad”,
“name”: “Default Data Loader”,
“type”: “@n8n/n8n-nodes-langchain.documentDefaultDataLoader”,
“typeVersion”: 1,
“position”: [
672,
1296
]
},
{
“parameters”: {
“model”: “text-embedding-3-small”,
“options”: {}
},
“id”: “f4096e78-c17e-49c7-b7bd-dc497898cd67”,
“name”: “Embeddings OpenAI1”,
“type”: “@n8n/n8n-nodes-langchain.embeddingsOpenAi”,
“typeVersion”: 1,
“position”: [
432,
1296
],
“credentials”: {
“openAiApi”: {
“id”: “-”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“operation”: “download”,
“fileId”: {
“__rl”: true,
“value”: “={{ $(‘Set File ID’).item.json.file_id }}”,
“mode”: “id”
},
“options”: {
“googleFileConversion”: {
“conversion”: {
“docsToFormat”: “text/plain”
}
}
}
},
“id”: “56283f30-f62e-4ea5-b9f8-243ceed80bfb”,
“name”: “Download File”,
“type”: “n8n-nodes-base.googleDrive”,
“typeVersion”: 3,
“position”: [
-992,
976
],
“executeOnce”: true,
“credentials”: {
“googleDriveOAuth2Api”: {
“id”: “-”,
“name”: “Google Drive account”
}
}
},
{
“parameters”: {
“pollTimes”: {
“item”: [
{
“mode”: “everyMinute”
}
]
},
“triggerOn”: “specificFolder”,
“folderToWatch”: {
“__rl”: true,
“value”: “1toDtne9gkVjtZE4c7XqsKJw9yI5AeCr8”,
“mode”: “list”,
“cachedResultName”: “n8n Documents”,
“cachedResultUrl”: “https://drive.google.com/drive/folders/1toDtne9gkVjtZE4c7XqsKJw9yI5AeCr8”
},
“event”: “fileCreated”,
“options”: {}
},
“id”: “bd08ac5f-ab2b-4048-bc89-1a5ebd1949b0”,
“name”: “File Created”,
“type”: “n8n-nodes-base.googleDriveTrigger”,
“typeVersion”: 1,
“position”: [
-2016,
816
],
“credentials”: {
“googleDriveOAuth2Api”: {
“id”: “-”,
“name”: “Google Drive account”
}
}
},
{
“parameters”: {
“pollTimes”: {
“item”: [
{
“mode”: “everyMinute”
}
]
},
“triggerOn”: “specificFolder”,
“folderToWatch”: {
“__rl”: true,
“value”: “1toDtne9gkVjtZE4c7XqsKJw9yI5AeCr8”,
“mode”: “list”,
“cachedResultName”: “n8n Documents”,
“cachedResultUrl”: “https://drive.google.com/drive/folders/1toDtne9gkVjtZE4c7XqsKJw9yI5AeCr8”
},
“event”: “fileUpdated”,
“options”: {}
},
“id”: “44809bbe-d1a7-4cbb-a471-4f07abdc6169”,
“name”: “File Updated”,
“type”: “n8n-nodes-base.googleDriveTrigger”,
“typeVersion”: 1,
“position”: [
-2016,
976
],
“credentials”: {
“googleDriveOAuth2Api”: {
“id”: “-”,
“name”: “Google Drive account”
}
}
},
{
“parameters”: {
“operation”: “text”,
“options”: {}
},
“id”: “ebe51049-fc80-4a69-ac0a-2132120318c2”,
“name”: “Extract Document Text”,
“type”: “n8n-nodes-base.extractFromFile”,
“typeVersion”: 1,
“position”: [
-144,
1296
],
“alwaysOutputData”: true
},
{
“parameters”: {
“operation”: “delete”,
“tableId”: “documents”,
“filterType”: “string”,
“filterString”: “=metadata->>file_id=like.{{ $json.file_id }}”
},
“id”: “f8ccd212-5c68-4df3-a1e8-e4a035a67d29”,
“name”: “Delete Old Doc Rows”,
“type”: “n8n-nodes-base.supabase”,
“typeVersion”: 1,
“position”: [
-1472,
816
],
“alwaysOutputData”: true,
“credentials”: {
“supabaseApi”: {
“id”: “-”,
“name”: “Supabase account”
}
}
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “10646eae-ae46-4327-a4dc-9987c2d76173”,
“name”: “file_id”,
“value”: “={{ $json.id }}”,
“type”: “string”
},
{
“id”: “f4536df5-d0b1-4392-bf17-b8137fb31a44”,
“name”: “file_type”,
“value”: “={{ $json.mimeType }}”,
“type”: “string”
},
{
“id”: “77d782de-169d-4a46-8a8e-a3831c04d90f”,
“name”: “file_title”,
“value”: “={{ $json.name }}”,
“type”: “string”
},
{
“id”: “9bde4d7f-e4f3-4ebd-9338-dce1350f9eab”,
“name”: “file_url”,
“value”: “={{ $json.webViewLink }}”,
“type”: “string”
}
]
},
“options”: {}
},
“id”: “ff6c472a-7f40-4d31-81b7-7a3fa2501fc2”,
“name”: “Set File ID”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
-1664,
976
]
},
{
“parameters”: {
“operation”: “pdf”,
“options”: {}
},
“id”: “b11e45a8-5484-456e-8ec7-c78a782a5400”,
“name”: “Extract PDF Text”,
“type”: “n8n-nodes-base.extractFromFile”,
“typeVersion”: 1,
“position”: [
-144,
736
]
},
{
“parameters”: {
“aggregate”: “aggregateAllItemData”,
“options”: {}
},
“id”: “263ebfca-dc97-4922-942d-6aae09cd6b45”,
“name”: “Aggregate”,
“type”: “n8n-nodes-base.aggregate”,
“typeVersion”: 1,
“position”: [
-96,
912
]
},
{
“parameters”: {},
“id”: “cfa38a7c-2667-4b56-b888-033ae4a28e4e”,
“name”: “Character Text Splitter”,
“type”: “@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter”,
“typeVersion”: 1,
“position”: [
576,
1408
]
},
{
“parameters”: {
“fieldsToSummarize”: {
“values”: [
{
“aggregation”: “concatenate”,
“field”: “data”
}
]
},
“options”: {}
},
“id”: “7d2c74d4-ac0f-4aec-9d94-763f321a486c”,
“name”: “Summarize”,
“type”: “n8n-nodes-base.summarize”,
“typeVersion”: 1,
“position”: [
112,
992
]
},
{
“parameters”: {
“rules”: {
“values”: [
{
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 1
},
“conditions”: [
{
“leftValue”: “={{ $(‘Set File ID’).item.json.file_type }}”,
“rightValue”: “application/pdf”,
“operator”: {
“type”: “string”,
“operation”: “equals”
}
}
],
“combinator”: “and”
}
},
{
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 1
},
“conditions”: [
{
“id”: “2ae7faa7-a936-4621-a680-60c512163034”,
“leftValue”: “={{ $(‘Set File ID’).item.json.file_type }}”,
“rightValue”: “application/vnd.openxmlformats-officedocument.spreadsheetml.sheet”,
“operator”: {
“type”: “string”,
“operation”: “equals”,
“name”: “filter.operator.equals”
}
}
],
“combinator”: “and”
}
},
{
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 1
},
“conditions”: [
{
“id”: “fc193b06-363b-4699-a97d-e5a850138b0e”,
“leftValue”: “={{ $(‘Set File ID’).item.json.file_type }}”,
“rightValue”: “=application/vnd.google-apps.spreadsheet”,
“operator”: {
“type”: “string”,
“operation”: “equals”,
“name”: “filter.operator.equals”
}
}
],
“combinator”: “and”
}
},
{
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 1
},
“conditions”: [
{
“id”: “b69f5605-0179-4b02-9a32-e34bb085f82d”,
“leftValue”: “={{ $(‘Set File ID’).item.json.file_type }}”,
“rightValue”: “application/vnd.google-apps.document”,
“operator”: {
“type”: “string”,
“operation”: “equals”,
“name”: “filter.operator.equals”
}
}
],
“combinator”: “and”
}
}
]
},
“options”: {
“fallbackOutput”: 3
}
},
“id”: “5cba3234-307b-41fc-9a20-d96531b867d5”,
“name”: “Switch”,
“type”: “n8n-nodes-base.switch”,
“typeVersion”: 3,
“position”: [
-800,
944
]
},
{
“parameters”: {
“mode”: “insert”,
“tableName”: {
“__rl”: true,
“value”: “documents”,
“mode”: “list”,
“cachedResultName”: “documents”
},
“options”: {
“queryName”: “match_documents”
}
},
“id”: “0829d205-6f90-4c92-a6b6-f2278da01648”,
“name”: “Insert into Supabase Vectorstore”,
“type”: “@n8n/n8n-nodes-langchain.vectorStoreSupabase”,
“typeVersion”: 1,
“position”: [
592,
1072
],
“credentials”: {
“supabaseApi”: {
“id”: “-”,
“name”: “Supabase account”
}
}
},
{
“parameters”: {
“operation”: “xlsx”,
“options”: {}
},
“id”: “7c6b71a9-0b2e-4c0d-a761-e7c7755c4954”,
“name”: “Extract from Excel”,
“type”: “n8n-nodes-base.extractFromFile”,
“typeVersion”: 1,
“position”: [
-320,
912
]
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “f422e2e0-381c-46ea-8f38-3f58c501d8b9”,
“name”: “schema”,
“value”: “={{ $(‘Extract from Excel’).isExecuted ? $(‘Extract from Excel’).first().json.keys().toJsonString() : $(‘Extract from CSV’).first().json.keys().toJsonString() }}”,
“type”: “string”
},
{
“id”: “bb07c71e-5b60-4795-864c-cc3845b6bc46”,
“name”: “data”,
“value”: “={{ $json.concatenated_data }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
544,
848
],
“id”: “bf104b2f-ecb3-4665-aa8b-b5afccc5aaa3”,
“name”: “Set Schema”
},
{
“parameters”: {
“options”: {}
},
“type”: “n8n-nodes-base.extractFromFile”,
“typeVersion”: 1,
“position”: [
-320,
1088
],
“id”: “8fa249fd-828b-430a-9ed0-2433bfb98b3c”,
“name”: “Extract from CSV”
},
{
“parameters”: {
“options”: {
“reset”: false
}
},
“type”: “n8n-nodes-base.splitInBatches”,
“typeVersion”: 3,
“position”: [
-1840,
816
],
“id”: “af8503e5-a0d4-43a2-9bf4-10a5dd2a96b3”,
“name”: “Loop Over Items”
},
{
“parameters”: {
“operation”: “delete”,
“tableId”: “document_rows”,
“filters”: {
“conditions”: [
{
“keyName”: “dataset_id”,
“condition”: “eq”,
“keyValue”: “={{ $(‘Set File ID’).item.json.file_id }}”
}
]
}
},
“type”: “n8n-nodes-base.supabase”,
“typeVersion”: 1,
“position”: [
-1312,
976
],
“id”: “fe519fa6-9980-40a5-9dee-8e979ddeecb2”,
“name”: “Delete Old Data Rows”,
“alwaysOutputData”: true,
“executeOnce”: true,
“credentials”: {
“supabaseApi”: {
“id”: “-”,
“name”: “Supabase account”
}
}
},
{
“parameters”: {
“operation”: “upsert”,
“schema”: {
“__rl”: true,
“mode”: “list”,
“value”: “public”
},
“table”: {
“__rl”: true,
“value”: “document_metadata”,
“mode”: “list”,
“cachedResultName”: “document_metadata”
},
“columns”: {
“mappingMode”: “defineBelow”,
“value”: {
“id”: “={{ $(‘Set File ID’).item.json.file_id }}”,
“title”: “={{ $(‘Set File ID’).item.json.file_title }}”,
“url”: “={{ $(‘Set File ID’).item.json.file_url }}”
},
“matchingColumns”: [
“id”
],
“schema”: [
{
“id”: “id”,
“displayName”: “id”,
“required”: true,
“defaultMatch”: true,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true,
“removed”: false
},
{
“id”: “title”,
“displayName”: “title”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: false
},
{
“id”: “url”,
“displayName”: “url”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: false,
“removed”: false
},
{
“id”: “created_at”,
“displayName”: “created_at”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “dateTime”,
“canBeUsedToMatch”: false
},
{
“id”: “schema”,
“displayName”: “schema”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: false,
“removed”: true
}
],
“attemptToConvertTypes”: false,
“convertFieldsToString”: false
},
“options”: {}
},
“type”: “n8n-nodes-base.postgres”,
“typeVersion”: 2.5,
“position”: [
-1152,
832
],
“id”: “f917fd7e-0bf8-476d-8846-0e4e87d6b5f4”,
“name”: “Insert Document Metadata”,
“executeOnce”: true,
“credentials”: {
“postgres”: {
“id”: “-”,
“name”: “Postgres account”
}
}
},
{
“parameters”: {
“schema”: {
“__rl”: true,
“mode”: “list”,
“value”: “public”
},
“table”: {
“__rl”: true,
“value”: “document_rows”,
“mode”: “list”,
“cachedResultName”: “document_rows”
},
“columns”: {
“mappingMode”: “defineBelow”,
“value”: {
“dataset_id”: “={{ $(‘Set File ID’).item.json.file_id }}”,
“row_data”: “={{ $json.toJsonString().replaceAll(/‘/g, "’'") }}”
},
“matchingColumns”: [
“id”
],
“schema”: [
{
“id”: “id”,
“displayName”: “id”,
“required”: false,
“defaultMatch”: true,
“display”: true,
“type”: “number”,
“canBeUsedToMatch”: true,
“removed”: true
},
{
“id”: “dataset_id”,
“displayName”: “dataset_id”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true
},
{
“id”: “row_data”,
“displayName”: “row_data”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “object”,
“canBeUsedToMatch”: true
}
],
“attemptToConvertTypes”: false,
“convertFieldsToString”: false
},
“options”: {}
},
“type”: “n8n-nodes-base.postgres”,
“typeVersion”: 2.5,
“position”: [
-96,
1088
],
“id”: “3091f04c-f09d-4428-839b-7c04bc736d6d”,
“name”: “Insert Table Rows”
},
{
“parameters”: {
“operation”: “upsert”,
“schema”: {
“__rl”: true,
“mode”: “list”,
“value”: “public”
},
“table”: {
“__rl”: true,
“value”: “document_metadata”,
“mode”: “list”,
“cachedResultName”: “document_metadata”
},
“columns”: {
“mappingMode”: “defineBelow”,
“value”: {
“id”: “={{ $(‘Set File ID’).item.json.file_id }}”,
“schema”: “={{ $json.schema }}”
},
“matchingColumns”: [
“id”
],
“schema”: [
{
“id”: “id”,
“displayName”: “id”,
“required”: true,
“defaultMatch”: true,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true,
“removed”: false
},
{
“id”: “title”,
“displayName”: “title”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: false,
“removed”: true
},
{
“id”: “url”,
“displayName”: “url”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: false,
“removed”: true
},
{
“id”: “created_at”,
“displayName”: “created_at”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “dateTime”,
“canBeUsedToMatch”: false
},
{
“id”: “schema”,
“displayName”: “schema”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: false,
“removed”: false
}
],
“attemptToConvertTypes”: false,
“convertFieldsToString”: false
},
“options”: {}
},
“type”: “n8n-nodes-base.postgres”,
“typeVersion”: 2.5,
“position”: [
768,
848
],
“id”: “ca53cc61-289e-4722-a0fe-a858dfadad1e”,
“name”: “Update Schema for Document Metadata”,
“credentials”: {
“postgres”: {
“id”: “-”,
“name”: “Postgres account”
}
}
}
],
“connections”: {
“Default Data Loader”: {
“ai_document”: [
[
{
“node”: “Insert into Supabase Vectorstore”,
“type”: “ai_document”,
“index”: 0
}
]
]
},
“Embeddings OpenAI1”: {
“ai_embedding”: [
[
{
“node”: “Insert into Supabase Vectorstore”,
“type”: “ai_embedding”,
“index”: 0
}
]
]
},
“Download File”: {
“main”: [
[
{
“node”: “Switch”,
“type”: “main”,
“index”: 0
}
]
]
},
“File Created”: {
“main”: [
[
{
“node”: “Loop Over Items”,
“type”: “main”,
“index”: 0
}
]
]
},
“File Updated”: {
“main”: [
[
{
“node”: “Loop Over Items”,
“type”: “main”,
“index”: 0
}
]
]
},
“Extract Document Text”: {
“main”: [
[
{
“node”: “Insert into Supabase Vectorstore”,
“type”: “main”,
“index”: 0
}
]
]
},
“Delete Old Doc Rows”: {
“main”: [
[
{
“node”: “Delete Old Data Rows”,
“type”: “main”,
“index”: 0
}
]
]
},
“Set File ID”: {
“main”: [
[
{
“node”: “Delete Old Doc Rows”,
“type”: “main”,
“index”: 0
}
]
]
},
“Extract PDF Text”: {
“main”: [
[
{
“node”: “Insert into Supabase Vectorstore”,
“type”: “main”,
“index”: 0
}
]
]
},
“Aggregate”: {
“main”: [
[
{
“node”: “Summarize”,
“type”: “main”,
“index”: 0
}
]
]
},
“Character Text Splitter”: {
“ai_textSplitter”: [
[
{
“node”: “Default Data Loader”,
“type”: “ai_textSplitter”,
“index”: 0
}
]
]
},
“Summarize”: {
“main”: [
[
{
“node”: “Set Schema”,
“type”: “main”,
“index”: 0
},
{
“node”: “Insert into Supabase Vectorstore”,
“type”: “main”,
“index”: 0
}
]
]
},
“Switch”: {
“main”: [
[
{
“node”: “Extract PDF Text”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “Extract from Excel”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “Extract from CSV”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “Extract Document Text”,
“type”: “main”,
“index”: 0
}
]
]
},
“Insert into Supabase Vectorstore”: {
“main”: [
[
{
“node”: “Loop Over Items”,
“type”: “main”,
“index”: 0
}
]
]
},
“Extract from Excel”: {
“main”: [
[
{
“node”: “Aggregate”,
“type”: “main”,
“index”: 0
},
{
“node”: “Insert Table Rows”,
“type”: “main”,
“index”: 0
}
]
]
},
“Set Schema”: {
“main”: [
[
{
“node”: “Update Schema for Document Metadata”,
“type”: “main”,
“index”: 0
}
]
]
},
“Extract from CSV”: {
“main”: [
[
{
“node”: “Aggregate”,
“type”: “main”,
“index”: 0
},
{
“node”: “Insert Table Rows”,
“type”: “main”,
“index”: 0
}
]
]
},
“Loop Over Items”: {
“main”: [
,
[
{
“node”: “Set File ID”,
“type”: “main”,
“index”: 0
}
]
]
},
“Delete Old Data Rows”: {
“main”: [
[
{
“node”: “Insert Document Metadata”,
“type”: “main”,
“index”: 0
}
]
]
},
“Insert Document Metadata”: {
“main”: [
[
{
“node”: “Download File”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“instanceId”: “07a408bca1780e201c0876023c9ba92568cd8a1f20636ff91b9815b1533c5b42”
}
}
Share the output returned by the last node
Information on your n8n setup
- n8n version: 1.104.2
- Database (default: SQLite): should be SQLite as I have not changed any core settings.
- n8n EXECUTIONS_PROCESS setting (default: own, main): main
- Running n8n via (Docker, npm, n8n cloud, desktop app): n8n Cloud
- Operating system: Win 11 x64 based processor