Describe the problem/error/question
I’m following an n8n course and I’m pretty sure that I have everything set properly, but whenever I execute the workflow I get an access error. My Supabase account is connected via API key “service_role
secret” in legacy tab, so I don’t understand why the node is unable to access the table.
I just now tried to open Data API access in Supabase and exposed my table for access, but still got a different access error.
Would appreciate any help offered
What is the error message (if any)?
Error inserting: permission denied for sequence documents_id_seq 403 Forbidden
Please share your workflow
Share the output returned by the last node
It did not return a clear output, but what I simply need is sending the embedding vector data bakc to Supabase in a chunks.
Information on your n8n setup
- n8n version: 2.35.7
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): In browser
- Operating system: Windows 11 Home
This is my sql editor code for a simple vector store if it has anything related:
-- 1. Enable the pgvector extension to allow vector data types
create extension if not exists vector;
-- 2. Create the documents table to store your embeddings
create table if not exists documents (
id bigserial primary key,
content text, -- Stores the text chunk
metadata jsonb, -- Stores source, file name, or author data
embedding vector(1536) -- 1536 dimensions is standard for OpenAI models
);
-- 3. Create an HNSW index for high-performance similarity search
-- Note: Use 'vector_cosine_ops' for cosine distance searches
create index on documents using hnsw (embedding vector_cosine_ops);
-- 4. Create the similarity search function (called by AI/RAG tools)
create or replace function match_documents (
query_embedding vector(1536),
match_threshold float,
match_count int
)
returns table (
id bigint,
content text,
metadata jsonb,
similarity float
)
language plpgsql stable
as $$
begin
return query
select
documents.id,
documents.content,
documents.metadata,
1 - (documents.embedding <=> query_embedding) as similarity
from documents
where 1 - (documents.embedding <=> query_embedding) > match_threshold
order documents.embedding <=> query_embedding asc
limit match_count;
end;
$$;