Heroku Row Limit Exceeded

Jacob Kenny
3 min readJun 17, 2022

--

The warnings started months ago —[warning] Database disruption imminent, row limit exceeded for hobby-dev database on Heroku app trip-tracker-backend. The italicized portion of the above sentence was the subject line of an email that I received from Heroku regarding an application, specifically the back end of an application, that I was hosting on Heroku’s free “hobby-dev” platform.

Email from Heroku Dated 04/28/2022

As I had already surpassed the supposed limit by over 50%, I couldn’t bury my curiosity — I had to find out how far it would go before something would actually happen. Sadly, it didn’t go much further than that. On May 6th, 2022 [one day more than the originally promised seven] I received notification that the insert privileges had been revoked and the database has become read only.

The creation of rows is largely from an automated process that I’ve detailed in previous posts — it’s not as if there are scores of users creating all the data. So with my insert privileges revoked (haha) my options to reinstate would be either to upgrade to a paid plan, or clear out the data and start over. I’m wary of being penny wise and pound foolish, but there is no way I’m paying a few dollars a month just to continue to kick the can down the road. With my decision made to just reset the database I head over to Heroku, reset my password so I can log in , and open up a console session. I know ultimately that I need to clear out all my data, and then re-seed the database. Normally I wouldn’t be so cavalier in entering non-reversible terminal commands that I find online without double checking, but the app is broken either way so I figure what’s the harm in entering in “rake db:reset” into the ol’ terminal.

Sadly, upon entering the command to reset the database, I received a long error message with the key point being as follows:

You are attempting to run a destructive action against your ‘production’ database.
If you are sure you want to continue, run the same command with the environment variable:
DISABLE_DATABASE_ENVIRONMENT_CHECK=1

When searching with this error message, there are plenty of people online who will tell you to just go ahead and run the same command with adding on the line about disabling the database environment check: “rake db:reset DISABLE_DATABASE_ENVIRONMENT_CHECK=1”, and logically I can understand why. However when entering this command, it seems like it gets a little bit further but still fails. This time the error message reads:

PG::ConnectionBad: connection to server at "ec2-3-211-52-48.compute-1.amazonaws.com" (3.211.52.48), port 5432 failed: FATAL:  permission denied for database "postgres"
DETAIL: User does not have CONNECT privilege.

All this to say, perhaps I should have started by checking in directly with Heroku on the subject. I had originally wanted to keep everything online by using the built-in console on the app’s maintenance page, as I did not have the Heroku CLI installed on my computer, but at this point, what to me should have been a simple one line command was turning into a bit of an ordeal and so I felt that I would be able to move a little faster using my own terminal and I broke down and installed the Heroku CLI.

Using the Heroku CLI, my mentality of being willing to try anything to make this happen never wavered, nor did my desire to NOT have to delete the app and start over. In the terminal I finally got the command “heroku pg:reset -a=trip-tracker-backend”, which runs the db:drop, db:create, and db:migrate all at once. Last thing to do is remember to re-seed, and I’m all good to go

--

--

No responses yet