TAGS :Viewed: 8 - Published at: a few seconds ago

[ Application error when deploying Sinatra app using DataMapper + postgres ]

I'm trying to deploy a simple Sinatra app to Heroku, I'm using postgresql, my Gemfile looks like this:

gem 'sinatra'
gem 'data_mapper'
gem 'dm-postgres-adapter'
gem 'pg'
gem 'database_cleaner'
gem 'bcrypt-ruby'
gem 'rack-flash3'
gem 'sinatra-partial'
gem 'mandrill-api'

group :development, :test do
  gem 'capybara'
  gem 'shotgun'
  gem 'rspec'
  gem 'debugger'
end

I have the pg add-on on my app, This is how my datamapper_setup.rb looks:

env = ENV['RACK_ENV'] || "development"

DataMapper.setup(:default, ENV['DATABASE_URL'] || "postgres://localhost/bookmark_manager_#    {env}")

DataMapper.finalize

DataMapper.auto_upgrade!

I don't know how to interpret the logs from heroku but here they are:

2014-03-29T13:35:47.674101+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=staging-bookmarkmanager.herokuapp.com request_id=304ebd75-859f-4768-9766-f25ca2fdf3ba fwd="77.99.158.5" dyno= connect= service= status=503 bytes=
2014-03-29T13:35:48.545822+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=staging-bookmarkmanager.herokuapp.com request_id=1669c22c-60c2-4d74-9967-7e60b32d49ad fwd="77.99.158.5" dyno= connect= service= status=503 bytes=
2014-03-29T13:35:51.486444+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=staging-bookmarkmanager.herokuapp.com request_id=6c70962d-7313-4dee-82de-5c12ca091aab fwd="77.99.158.5" dyno= connect= service= status=503 bytes=
2014-03-29T13:35:52.025452+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=staging-bookmarkmanager.herokuapp.com request_id=9166bd84-2187-4d2c-bf01-13a1a5574ac1 fwd="77.99.158.5" dyno= connect= service= status=503 bytes=

Any ideas on why is this happening? I've tried several approaches already with no luck.

Answer 1


In the additional logs you posted, it would seem that the database is refusing your connection:

FATAL:  role "xbwj…jedif" is not permitted to log in (DataObjects::ConnectionError)

Verify the that the credentials provided by ENV['DATABASE_URL'] are the same as those listed in the output of heroku config.