mimemagicrb/mimemagic

Rake error deploying to Heroku with 0.3.10

bjnord opened this issue · 1 comments

We've been using the USE_FREEDESKTOP_PLACEHOLDER=true approach and it's worked fine for our apps that are deployed elsewhere. But today I tried this approach for a Heroku-deployed app, and I get the following error. The bundle exec rake -P command works fine locally, but the dummy.xml file it's apparently looking for in the Heroku build/deploy environment is not there on my local system either.

My app details:

$ egrep "^ruby|^gem .rails| rails |mimemagic" Gemfile* .ruby-version | grep -v ':#'
Gemfile:ruby '2.7.3'
Gemfile:gem 'rails', '~> 5.2.4', '>= 5.2.4.4'
Gemfile:gem 'mimemagic', '~> 0.3.10'
Gemfile.lock:      mimemagic (~> 0.3.2)
Gemfile.lock:    mimemagic (0.3.10)
Gemfile.lock:    rails (5.2.4.4)
Gemfile.lock:  mimemagic (~> 0.3.10)
Gemfile.lock:  rails (~> 5.2.4, >= 5.2.4.4)
.ruby-version:ruby-2.7.3
$ heroku config:get USE_FREEDESKTOP_PLACEHOLDER
true
$ env | grep FREEDESK
USE_FREEDESKTOP_PLACEHOLDER=true
$ ls ~/.rvm/gems/ruby-2.7.3/gems/mimemagic-0.3.10/dummy.xml
ls: cannot access /home/bjn/.rvm/gems/ruby-2.7.3/gems/mimemagic-0.3.10/dummy.xml: No such file or directory
$ bundle exec rake -P | grep db:version
rake db:version
$ bundle -v
Bundler version 1.16.6

The Heroku build/deploy error:

-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.7.3
-----> Installing dependencies using bundler 1.17.3
       Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1 bundle install -j4
       Using rake 13.0.1
[...]
       Using mimemagic 0.3.10
[...]
       Bundle complete! 25 Gemfile dependencies, 62 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into `./vendor/bundle`
       Removing bundler (1.17.3)
       Bundle completed (0.47s)
       Cleaning up the bundler cache.
-----> Installing node-v12.16.2-linux-x64
-----> Detecting rake tasks
 !
 !     Could not detect rake tasks
 !     ensure you can run `$ bundle exec rake -P` against your app
 !     and using the production group of your Gemfile.
 !     rake aborted!
 !     Errno::ENOENT: No such file or directory @ rb_sysopen - /tmp/build_f6907ac1/vendor/bundle/ruby/2.7.0/gems/mimemagic-0.3.10/dummy.xml

Looking at how USE_FREEDESKTOP_PLACEHOLDER is implemented, I don't think you can get it to work on Heroku (or any other platform where build step is separated from run step).

Maybe instead you could try creating an empty file manually (somewhere in your code) and point FREEDESKTOP_MIME_TYPES_PATH env var to it?