Search code examples
ruby-on-railsheroku

Heroku push error: "Your bundle is locked to mimemagic (0.3.5) from rubygems repository" AFTER update to Rails 6.1.3.2


I keep receiving this error Your bundle is locked to mimemagic (0.3.5) from rubygems repository when pushing to heroku.

I read the resolved issue on Github where the Rails team swapped the dependency on ActiveStorage from mimemagic to mini_mime. So I did what was recommended and upgraded my app from Rails 6.0.3 to 6.1.3.2. My Gemfile now has gem 'rails', '>=6.1.3.2'.

I ran bundle update which updated all the gems and I did a bundle uninstall mimemagic for good measure.

I verified in my Gemfile.lock that there is no longer a reference to mime_magic. Instead, I can see that activestorage has the updated dependency on mini_mime:

activestorage (6.1.3.2)
  actionpack (= 6.1.3.2)
  activejob (= 6.1.3.2)
  activerecord (= 6.1.3.2)
  activesupport (= 6.1.3.2)
  marcel (~> 1.0.0)
  mini_mime (~> 1.0.2)

All changes are committed in the repo. However, when I deploy to Heroku via git push heroku main, I still receive this Your bundle is locked to mimemagic (0.3.5) from rubygems repository error. How can there be a dependency when all gems were updated and no longer reference it, and its no longer present in both my local machine or Gemfile.lock?


Solution

  • I was porting my existing app to heroku, so I created a separate branch called heroku to make the changes. I wanted to test first-time deployment to heroku before merging with my main branch.

    So I was running $ git push heroku main expecting to push my local heroku branch to Heroku. Instead, it was pushing my main branch, which did not have the updated Rails gems.

    Lesson learned, running $ git push heroku main pushes your main branch even if you are currently on a different branch.

    I went into the settings for my Heroku app and did a manual build/deploy from Github of my heroku branch. App built and deployed successfully.