thiebo
thiebo

Reputation: 1435

heroku bundler: failed to load command: rackup

I'm trying to deploy to heroku a modular sinatra app that works fine locally. This is in the heroku logs:

2020-12-28T21:05:15.907560+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 58645`
2020-12-28T21:05:18.738254+00:00 app[web.1]: bundler: failed to load command: rackup (/app/vendor/bundle/ruby/2.7.0/bin/rackup)
2020-12-28T21:05:18.738283+00:00 app[web.1]: Gem::Exception: can't find executable rackup for gem rack. rack is not currently included in the bundle, perhaps you meant to add it to your Gemfile?

The command bundle exec rackup config.ru -p 58645 runs fine locally.

This is my config.ru

require_relative './config/environment.rb'
use EntreeController
use UserController
run ApplicationController

and environment.rb

APP_ENV = ENV["RACK_ENV"] || "development"
ENV['SINATRA_ENV'] ||= "development"

require 'require_all'
require 'bundler/setup'
Bundler.require(:default, ENV['SINATRA_ENV'])

require_all 'app'
require_all 'app/models'
require_all 'app/helpers'

And the Procfile:

web: bundle exec rackup config.ru -p $PORT

Upvotes: 2

Views: 2833

Answers (2)

Sergey Pedan
Sergey Pedan

Reputation: 179

Switching to Bundler 2.1.4 solved the problem in my case.

For the longer run one will have to install bundler 2.1.4 and use it, but for the sake of test I just manually edited that line in Gemfile.lock:

BUNDLED WITH
   2.1.4

I was using Ruby 2.7.2 and Bundler 2.2.8 — Heroku buildpack provided Bundler 2.1.4.

Funny that Heroku’s Bundler bugs list had nothing about 2.2.8.

Upvotes: 0

thiebo
thiebo

Reputation: 1435

I'll post my solution, if ever someone bumps into the same problem. I had followed the indication on the Rakefile here : https://github.com/sinatra-activerecord/sinatra-activerecord.

One solution was to entirely deleted the Rakefile when deploying to Heroku. The other solution is to put only this in the Rakefile :

require "sinatra/activerecord"
require "sinatra/activerecord/rake"
require "./app" # or whereever your app is

Upvotes: 1

Related Questions