노션 -> 데이터 추출 -> 분할 -> 포멧수정 (DB입력용) 까지 한 결과가 아래 코드라고 가정할 때,
[
{
"page_id": "21475de0-af84-80c0-b4c2-ee34b8653464",
"chunk": "테스트 청크 데이터",
"embedding": [0.01, -0.02, 0.003, 0.1, 0.001] // 짧은 테스트용 배열
}
]
embadding 항목의 배열을 그대로 insert하려고 하면, 에러가 발생한다
{
"errorMessage": "Bad request - please check your parameters",
"errorDescription": "Could not find the '{\n \"page_id\": \"21475de0-af84-80c0-b4c2-ee34b8653464\",\n \"chunk\": \"👋 보령 대천의 숨은 명소인 '향천리 냉풍욕장 식당'을 소개하는 정보 보령시 청라면 향천리 청성로 145-1 | 전화문의: 010-2035-7168, 010-2035-7168 📍 ' column of 'embeddings' in the schema cache",
"errorDetails": {
"rawErrorMessage": [
"400 - \"{\\\"code\\\":\\\"PGRST204\\\",\\\"details\\\":null,\\\"hint\\\":null,\\\"message\\\":\\\"Could not find the '{\\\\n \\\\\\\"page_id\\\\\\\": \\\\\\\"21475de0-af84-80c0-b4c2-ee34b8653464\\\\\\\",\\\\n \\\\\\\"chunk\\\\\\\": \\\\\\\"👋 보령 대천의 숨은 명소인 '향천리 냉풍욕장 식당'을 소개하는 정보 보령시 청라면 향천리 청성로 145-1 | 전화문의: 010-2035-7168, 010-2035-7168 📍 ' column of 'embeddings' in the schema cache\\\"}\""
],
"httpCode": "400"
},
"n8nDetails": {
"nodeName": "HTTP Request(Supabase)",
"nodeType": "n8n-nodes-base.httpRequest",
"nodeVersion": 4.2,
"itemIndex": 0,
"time": "2025. 6. 16. 오후 9:22:06",
"n8nVersion": "1.95.3 (Cloud)",
"binaryDataMode": "filesystem",
"stackTrace": [
"NodeApiError: Bad request - please check your parameters",
" at ExecuteContext.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_openai@4.78.1_encoding@0.1.13_zod@3.24.1_/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:1421:10)",
" at processTicksAndRejections (node:internal/process/task_queues:95:5)",
" at ExecuteContext.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_openai@4.78.1_encoding@0.1.13_zod@3.24.1_/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:1707:11)"
]
}
이때, HTTP Request 의 Body 부분에서 아래처럼 작성했다.
{
"page_id": "{{ $json.pageId }}",
"chunk": "{{ $json.chunk }}",
"embedding": {{ $json.embedding }}
}
결론은, n8n에서는 이렇게 수정해야 했던 것.
이유는
배열로 보내는 경우, Supabase API가 JSON을 그대로 벡터로 파싱하기 위해선 정확히 배열 형태여야 하며 문자열이 아니어야 한다. 하지만 n8n의 템플릿 표현식에서는 이게 제대로 처리되지 않는 경우가 있다고 함.
그래서 아래처럼 JSON.stringify()를 사용하여 어찌저찌 성공.
{
"page_id": "{{ $json.pageId }}",
"chunk": "{{ $json.chunk }}",
"embedding": {{ JSON.stringify($json.embedding) }}
}
728x90
'개발로그 > 자동화' 카테고리의 다른 글
n8n subpabase 초기설정 (가입,프로젝트,테이블생성) (0) | 2025.06.17 |
---|---|
n8n RAG sysem에서 실제 운영 워크플로우 기준 Supabase vs Airtable 무엇을 선택할까? (0) | 2025.06.17 |
n8n에서 RAG system을 만드는 과정 중, openAI의 embeded 용 모델을 확인하는 방법 (1) | 2025.06.16 |
n8n Deactivate workflow to executeBecause of limitations in Telegram Trigger, n8n can't listen for test executions at the same time as listening for production ones (0) | 2025.06.12 |
글감을 읽어올 Google Sheets 준비하기 (0) | 2025.04.19 |
WordPress REST API 계정 (Application Password 설정 하기) (0) | 2025.04.19 |
Step 02. Xhosting 가입 및 워드프레스 설치 (0) | 2025.04.18 |
Step 01 . 무료 호스팅 고르기 / 추천 목록 (자유설치형 WordPress 용) (2) | 2025.04.17 |
댓글