1

Trying to learn Sinatra I just deployed a simple app to heroku.

My config file:

require './main'
require 'sinatra'
run Sinatra::Application

Gemfile:

source 'http://rubygems.org'
ruby '1.9.3'
gem 'sinatra'
gem 'slim'
gem 'sass'
gem 'dm-core'
gem 'dm-migrations'
gem 'thin'
gem 'pg', :group => :production
gem 'dm-postgres-adapter', :group => :production
gem 'dm-sqlite-adapter', :group => :development

I get following error in the logs:

2015-03-31T09:13:54.051645+00:00 heroku[web.1]: State changed from crashed to starting
2015-03-31T09:13:57.281158+00:00 heroku[web.1]: Starting process with command `bundle exec ruby main.rb -p 28463`
2015-03-31T09:13:59.598142+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:163:in `require': cannot load such file -- dm-sqlite-adapter (LoadError)
2015-03-31T09:13:59.598161+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:163:in `load_adapter'
2015-03-31T09:13:59.598164+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:133:in `adapter_class'
2015-03-31T09:13:59.598165+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:13:in `new'
2015-03-31T09:13:59.598167+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.1/lib/dm-core.rb:230:in `setup'
2015-03-31T09:13:59.598169+00:00 app[web.1]:    from /app/song.rb:5:in `block in <top (required)>'
2015-03-31T09:13:59.598171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1410:in `configure'
2015-03-31T09:13:59.598172+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1989:in `block (2 levels) in delegate'
2015-03-31T09:13:59.598174+00:00 app[web.1]:    from /app/song.rb:4:in `<top (required)>'
2015-03-31T09:13:59.598178+00:00 app[web.1]:    from main.rb:6:in `require'
2015-03-31T09:13:59.598187+00:00 app[web.1]:    from main.rb:6:in `<main>'

2015-03-31T09:14:00.479331+00:00 heroku[web.1]: State changed from starting to crashed
2015-03-31T09:14:00.461548+00:00 heroku[web.1]: Process exited with status 1

I tried the solution proposed here but it did not work.

Thanks in advance for ideas

Community
  • 1
  • 1
Ilya Krasnov
  • 221
  • 4
  • 12
  • What does your `song.rb` file look like, specifically around line 4? I suspect you are using the same url for your db in each environment, and you need to make sure you use a different one in production. – matt Mar 31 '15 at 21:39
  • It's a load error, not an installation error (as you've noted), so you're probably calling `DataMapper`'s SQL adapter somewhere within your app, even when the app is running in the `production` environment (perhaps in the database connection/initialization procedures). Verify that you have environment checks when using `dm-sqlite-adapter`. Better yet, keep your local and Heroku environments as close as possible (install Postgres) because weird errors will creep up that will be hard to pin down when your DBs differ (speaking from experience). – Arman H Apr 01 '15 at 05:54

1 Answers1

0

I think you need datamapper in your Gemfile.

gem "datamapper"
Mehmet S.
  • 394
  • 3
  • 18