Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 4 and Heroku - rake assets:precompile trying to call Postgres
    text
    copied!<p>So I've spent a day on this and read every SO question even mildly related, and checked the Heroku docs.</p> <p>This is an Heroku issue when pushing: </p> <pre><code>-----&gt; Preparing app for Rails asset pipeline Running: rake assets:precompile rake aborted! could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? </code></pre> <p>I'm sure it's familiar. </p> <p>A lot of stuff changed with Heroku deployment on Rails 4 I am aware, but I even tried many of the pre 4.0 suggestions to try and fix it.</p> <p>Its: </p> <pre><code> /tmp/build_22xpuyyrmltz6/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `initialize' /tmp/build_22xpuyyrmltz6/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `new' /tmp/build_22xpuyyrmltz6/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `connect' /tmp/build_22xpuyyrmltz6/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:542:in `initialize' /tmp/build_22xpuyyrmltz6/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new' /tmp/build_22xpuyyrmltz6/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection' </code></pre> <p>etc... so from what I gather this is because is trying to access the db during compile time.</p> <p>My question so far is a carbon copy of <a href="https://stackoverflow.com/questions/16432825/heroku-precompile-assets-failed-on-rail-4-app">this question</a></p> <pre><code>RAILS_ENV=production bundle exec rake assets:precompile </code></pre> <p>Runs fine and the manifest.json is generated, yet Heroku doesn't recognise it.</p> <p>I also tried this, but I think Rails 4 is false by default anyway.</p> <pre><code>config.assets.initialize_on_precompile = false </code></pre> <p>So then a workaround-ish thing I was happy to try was:</p> <pre><code>heroku labs:enable user-env-compile </code></pre> <p>and I tried this the most, created new heroku apps, toggled it on and off and on again. Tried multiple pushes. I was committing when needed as well so it wasn't that.</p> <p>also tried rails_12factor and some other stuff I can't remember. All to no avail.</p> <p>Is there something I'm missing? user-env-compile seems to be solving everybody else's problems but seemingly has no effect for me.</p> <p>I've even restarted my computer a few times... any help would be appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload