Forem Creators and Builders 🌱

Rafael Lima
Rafael Lima

Posted on

Heroku deployment error PG::DuplicatePstatement

After installing forem on Heroku and setting everything I've got this annoying error:

ActiveRecord::StatementInvalid (PG::DuplicatePstatement: ERROR:
prepared statement "a1" already exists
Enter fullscreen mode Exit fullscreen mode

After digging a little bit and reading some pages on heroku docs, I realized that I should disable prepared statements. The gotcha is that this is information is not present on Heroku docs, only in the README of PgBouncer buildpack that is used by forem.

So, the solution was to set up the environment variable PGBOUNCER_PREPARED_STATEMENTS to false. To do that run the following command:

$ heroku config:set PGBOUNCER_PREPARED_STATEMENTS=false
Enter fullscreen mode Exit fullscreen mode

VoilΓ !

I hope this posts helps people who are trying to deploy forem on Heroku.

Latest comments (1)

Collapse
 
ellativity profile image
Ella (she/her/elle)

Thanks for sharing @rafaelp !

Just to reiterate to anyone who doesn't already know this that Forem doesn't currently support Heroku installations so, while you can absolutely use Forem any way you like, our team can't help you out if you get stuck. That makes posts like Rafael's even more useful to those out there who are attenpting Heroku installations themselves!