Fix for Heroku Breaking Ancient Apps
Photo by Christophe BENOIT on Flickr https://www.flickr.com/photos/christophebenoit/21828243446
Licensed under Creative Commons CC BY 2.0: https://creativecommons.org/licenses/by/2.0/
Have a really old Heroku app that recently broke? We still help with more cedar-14 apps, mostly Rails, than I’d like to admit, and they all seemed to break this week.
Heroku has been doing some database maintenance, and has been “helpfully” upgrading old databases to Postgres 14. Normally, I might be excited about that, but these old apps can’t handle it. We see an error like this:
PG::InvalidParameterValue: ERROR: invalid value for parameter "client_min_messages": "panic" HINT: Available values: debug5, debug4, debug3, debug2, debug1, log, notice, warning, error. : SET client_min_messages TO 'panic'
The fix is straightforward, at least for now:
1. Add a new database, the same size, but with Postgres 11. Note: you can only do this from the command line.
heroku addons:create heroku-postgresql:basic --version=11 --app your-app-here
2. Find the ENV var name, in my case today it was
3. Copy the data, like normal.
heroku pg:copy DATABASE_URL HEROKU_POSTGRESQL_MAUVE --app your-app-here
4. Promote the database
heroku pg:promote HEROKU_POSTGRESQL_MAUVE --app your-app-here
5. Delete the old DB
Save yourself some money.
…at least until these really old apps or DBs no longer run. But that’s a harder upgrade path. Contact us if you need help with that.