Critical Softr - Supabase connection issue: Supabase pool exhausted with only 1 user

TL;DR: Connection leak between Softr and Supabase causing 110+ “zombie” connections and app crashes with only 1 active user on a Supabase Large Plan ($110 p/m).

Hi everyone :grinning_face_with_smiling_eyes:

I am seeking help with a connection issue affecting two of my Softr applications powered by Supabase. The one I’m currently working on is a new application that I had to create because the current application, which ran on Airtable, was getting way too slow after reaching around 100.000 records. I chose Supabase because it is known to be very scalable (unlimited records + users), safe and capable, which makes it the best fit for me.

I launched the new application 1 month ago but since the start there have been many problems with the number of Database Connections which causes the app to crash every few hours. With just 1 active user in Softr, the application creates so many connections with the database that even the large Supabase plan ($110 p/m) makes the application freeze and completely unusable. Here is a screenshot of my Supabase dashboard (Shared Pooler (Supavisor) shows the same trend) I’ll explain further:

As you can see in this image, there are just 1 or 2 users and the peak is around 136 connections, which is very high considering the number of users. It seems like there is a connection leak, the old connections are not being disconnected. You can see this especially on the right with the horizontal line of 110 connections which is during the night with 0 users on the app. When my client logs in on the app in the morning nothing works and I have to manually restart the project in Supabase to close all of the connections.

When I’m on the app and looking at the Network tab in the DevTools I see a fetch being made every 8 seconds. This fetch usually takes a few ms to 1.5s but when the pool is full (max database connections) the fetch time gets up to 11s or is interrupted, making the application unusable. Sometimes after being in the app for some time, it starts doing 2 fetches simultaneously.

For the last week I’ve been in contact with Softr CS to talk about the issues in my applications but unfortunately they could not help me with these problems. I also added them as collaborators to my application and they did not see anything suspicious. They told me Softr only makes 5 connections with Supabase and that I should talk with them instead.

I’ve talked with a few people I know who code applications and know a few things about DBA and they say that it is very odd. They say Supabase should be able to handle thousands, say millions of users, as also mentioned by Softr. They say it is very odd that my application crashes on Supabase’s $110 per month plan with just 1 or 2 users and that there are too many Database connections being made.

What I’ve found so far:

  • Supabase support suggested that the client (Softr) might not be explicitly closing sessions, leading to “zombie” connections.
  • I tried switching to Transaction Mode (Port 6543) to help with scaling, but this triggered SQL grammar errors in my Softr app (see image).

I’m a very positive person who is sure that there is a solution to this, but I’m out of ideas. That is why I’m asking in the Softr community now if you have had a similar problem, or can tell me what I’m doing wrong. Softer says it is feasible and I totally agree, but what am I missing? :thinking:

Details on my Softr + Supabase subscriptions and the database + connection
Softr
Pages: 27 in total (8 of them are primarily used, the others sporadically)
Users: 1-2 users (Mostly 1)
No custom code is used
User Caching is ON
Single page application (SPA) is ON

Supabase
Compute Size: Large ($110 per month)
Memory: 8 GB
Direct connections: 160
Pooler connections: 800
Pool size: 128 (but also tried 45, 72, 96)
Data: 0.04GB
Total tables: 12
Total columns: 198
Total records: 6642 (problems were there with 100 records as well)

Softr <> Supabase connection
I connected Softr with Supabase according to Softr’s guidelines.
host: aws-1-eu-west-1.pooler.supabase.com
port: 5432
database: postgres
user: postgres.[redacted]
pool_mode: session

Honestly, the softr ←→ supabase integration isn’t great. It’s missing various features (I.e. you can’t use workflows that interact with it, select options can’t auto-populate, I’m not convinced the ‘table relations’ work (I.e. where you say ‘one-to-many’), and probably more.

That being said, we use the intergration and don’t have the connection pool issue you describe.

We have a pool size of 100, but our connections never go above 40. They fluctuate a bit, as we also use serverless functions hosted externally.

Do you have anything else that’s also using your supabase DB? I.e. some scripts hosted with AWS/Google Cloud/Azure?


I’m assuming AI guided you towards using softr & supabase, but it’s not really a great combo for anything above very very simple applications. It’s also probably one of the most expensive routes to go down too.

If you only ever interface with your DB via the softr website, I’d suggest using softr’s own Softr Database. If you don’t, you should probably re-think your tech stack.

EDIT: I didn’t realise you need the softr Business plan ($323/mo) for over 50,000 records with Softr Database. Yikes.

Postgres databases (which is what supabase wraps around) can handle hundreds of millions of rows, the ‘limit counts’ are just artificial caps being placed by providers to better monetise it. I wouldn’t worry about the size of your database being a factor when it comes to ‘performance’, it’s tiny.

2 Likes