Supabse is installed via self-hosted docker.
File uploaded successfully, but Chatbot-ui is unable to read it while chatting.
Press F12 to open developer tools for browser, we can see a request, status=500,file=retrieve,response={message:"An unexpected error occurred"}. It shows nothing helpful for us. So let's make the response more friendly.
Open file app/api/retrieval/retrieve/route.ts, and edit Line 96 like below:
Restart the app, upload file, and chat. This time we get a response like below:
{
"code":"42883",
"details":null,
"hint":"No operator matches the given name and argument types. You might need to add explicit type casts.",
"message":"operator does not exist: extensions.vector <=> extensions.vector"
}
Go to supabase admin, Database --> Extensions, ensure extension vector is enabled.
If extension vector is enabled, it seems that postgrest cannot search for it.
Solution
Go to the supabase docker compose file, find Rest section:
rest:
container_name: supabase-rest
image: postgrest/postgrest:v12.0.1
depends_on:
db:
# Disable this if you are using an external Postgres database
condition: service_healthy
analytics:
condition: service_healthy
restart: unless-stopped
environment:
PGRST_DB_URI: postgres://authenticator:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
PGRST_DB_SCHEMAS: ${PGRST_DB_SCHEMAS}
# Add below line to set the env variable PGRST_DB_EXTRA_SEARCH_PATH
PGRST_DB_EXTRA_SEARCH_PATH: ${PGRST_DB_EXTRA_SEARCH_PATH}
PGRST_DB_ANON_ROLE: anon
PGRST_JWT_SECRET: ${JWT_SECRET}
PGRST_DB_USE_LEGACY_GUCS: "false"
PGRST_APP_SETTINGS_JWT_SECRET: ${JWT_SECRET}
PGRST_APP_SETTINGS_JWT_EXP: ${JWT_EXPIRY}
command: "postgrest"
Go to supabase .env file, find API section:
############
# API - Configuration for PostgREST.
############
PGRST_DB_SCHEMAS=public,storage,graphql_public
# Add below line to set extra search path within "public" and "extensions".
PGRST_DB_EXTRA_SEARCH_PATH=public,extensions
Restart supabase:
docker compose stop && docker compose up -d
Try to chat with file again, and finally find the issue is solved.
Bug Description
Supabse is installed via self-hosted docker. File uploaded successfully, but Chatbot-ui is unable to read it while chatting. Press F12 to open developer tools for browser, we can see a request, status=500,file=retrieve,response={message:"An unexpected error occurred"}. It shows nothing helpful for us. So let's make the response more friendly. Open file
app/api/retrieval/retrieve/route.ts
, and edit Line 96 like below:Restart the app, upload file, and chat. This time we get a response like below:
Go to supabase admin, Database --> Extensions, ensure extension vector is enabled.
If extension vector is enabled, it seems that postgrest cannot search for it.
Solution
Go to the supabase docker compose file, find Rest section:
Go to supabase
.env
file, find API section:Restart supabase:
Try to chat with file again, and finally find the issue is solved.