Open jbbae opened 3 months ago
Hey @jbbae,
I've looked into the issues you're facing with your FastAPI backend on Render when connecting to Supabase using SupabaseVectorStore
. Let's tackle them one by one.
The error message you're encountering suggests that the Render environment is unable to establish a connection to your Supabase database. This could be due to network policies on Render's side or incorrect database connection details.
sqlalchemy.exc.NoSuchModuleError
This error is typically caused by a typo in the protocol part of the SQLAlchemy database URL or a missing SQLAlchemy dialect for the database you're trying to connect to.
Solution: The correct protocol for PostgreSQL connections with SQLAlchemy is postgresql://
, not postgres://
. However, your update indicates you've already corrected this. The error message Can't load plugin: sqlalchemy.dialects:postgres
suggests that SQLAlchemy is looking for a dialect named postgres
, which doesn't exist. The correct dialect name is postgresql
.
Make sure your SUPABASE_DB_URL
environment variable starts with postgresql://
. If the issue persists, ensure you have the psycopg2
library installed in your environment, as it's the standard PostgreSQL adapter for Python and required for SQLAlchemy to connect to PostgreSQL databases.
If you continue to face issues with Render, you might consider other hosting solutions that are known to work well with FastAPI and PostgreSQL, such as Heroku, DigitalOcean App Platform, or AWS Elastic Beanstalk. Each of these platforms has its own set of features and pricing, so you'll want to choose one that best fits your project's needs and budget.
I hope this helps you move forward with your project. If you have any more questions or run into further issues, feel free to ask!
Best, Dosu
@jbbae
The URI should start with postgresql:// instead of postgres://.
SQLAlchemy used to accept both, but has removed support for the postgres name.
Bug Description
I have a Python backend for my LlamaIndex application (using FastAPI + Render) that uses "SupabaseVectorStore" to set up the connection with my Supabase DB. It works 100% fine locally on localhost, but when I host it in Render, I suddenly get this error:
Version
0.10.26
Steps to Reproduce
The code where the Supabase DB connection is setup is:
where:
UPDATE: Since reading this post from Supabase, I also tried the "pooling string", where (in addition to updating the code to start with "postgres://"):
But this now yields:
Anyone have any idea how to fix this? I've been grappling with this for HOURS and am completely lost... š Alternatively - is there a better recommended place to host my RAG chatbot backend (what this FastAPI code is supposed to do)?
Relevant Logs/Tracbacks