Which was caused by the pg_net HTTP client closing the connecting too early due to a timeout (2000 ms).
Solution
Generating embeddings can take time, so this PR increases the timeout to 300000 ms (5 minutes) by default, and also allows you to specify a custom timeout via an optional fourth trigger argument:
create trigger embed_document_sections
after insert on document_sections
referencing new table as inserted
for each statement
execute procedure private.embed(content, embedding, 5, 300000);
Problem
We were consistently seeing this error in the
embed
edge function:Which was caused by the
pg_net
HTTP client closing the connecting too early due to a timeout (2000 ms).Solution
Generating embeddings can take time, so this PR increases the timeout to 300000 ms (5 minutes) by default, and also allows you to specify a custom timeout via an optional fourth trigger argument:
Fixes https://github.com/supabase-community/chatgpt-your-files/issues/11.