Heroku Ruby on Rails app push failed - ruby-on-rails

Lately I upgraded my rails app from Rails 3 to Rails 5 and from Bootstrap 2 to Bootstrap 4 and after solving it all I am having some trouble uploading it to Heroku. I mean, in local it works perfectly with rails server. But when I have tried to upload it I get an error and I can't find any similar case on the Internet. This is what I get after git push heroku master:
Counting objects: 122, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (119/119), done.
Writing objects: 100% (122/122), 31.05 KiB | 1.48 MiB/s, done.
Total 122 (delta 77), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: Your app was upgraded to bundler 1.15.2.
remote: Previously you had a successful deploy with bundler 1.5.2.
remote:
remote: If you see problems related to the bundler version please refer to:
remote: https://devcenter.heroku.com/articles/bundler-version
remote: -----> Using Ruby version: ruby-1.9.2
remote: ###### WARNING:
remote: Removing `Gemfile.lock` because it was generated on Windows.
remote: Bundler will do a full resolve so native gems are handled properly.
remote: This may result in unexpected gem versions being used in your app.
remote: In rare occasions Bundler may not be able to resolve your dependencies at all.
remote: https://devcenter.heroku.com/articles/bundler-windows-gemfile
remote:
remote: -----> Installing dependencies using bundler 1.15.2
remote: Purging Cache. Changing stack from cedar to cedar-14
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4
remote: Fetching gem metadata from https://rubygems.org/........
remote: Fetching version metadata from https://rubygems.org/..
remote: Fetching dependency metadata from https://rubygems.org/.
remote: Resolving dependencies...
remote: The latest bundler is 1.16.0, but you are currently running 1.15.2.
remote: To update, run `gem install bundler`
remote: Bundler could not find compatible versions for gem "rubygemsils (= 5.1.4) was resolved to 5.1.4, which depends on
remote: rubygems Bundler Output: Fetching gem metadata from https://rubygems.org/........
remote: Fetching version metadata from https://rubygems.org/..
remote: Fetching dependency metadata from https://rubygems.org/.
remote: Resolving dependencies...
remote: The latest bundler is 1.16.0, but you are currently running 1.15.2.
remote: To update, run `gem install bundler`
remote: Bundler could not find compatible versions for gem "rubygemsresolved to 5.1.4, which depends on
remote: rubygems ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to keepmefit.
remote:
I know it complains about my bundler version but it should be a warning and not a real error. I guess the problem must be in one of the gems that may not be compatible with Heroku or Rails 5 now but they give no problem on local server. Here's my Gemfile:
source 'https://rubygems.org'
gem 'rails', '5.1.4'
if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
group :development, :test do
gem 'sqlite3'
gem 'activemodel'
gem 'json'
gem 'rspec-rails'
gem 'guard-rspec'
gem 'rb-notifu'
end
# Heroku uses PostreSQL
group :production do
gem 'pg'
end
group :test do
gem 'capybara'
gem 'factory_girl_rails', '4.1.0'
gem 'launchy'
end
group :development do
gem 'annotate'
gem 'better_errors'
gem 'binding_of_caller'
gem 'meta_request'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'coffee-script-source', '1.8.0'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
#gem 'bcrypt-ruby'
gem 'bcrypt', '~> 3.1.11', platforms: [:ruby, :x64_mingw, :mingw]
# HTML abstraction language (Haml)
gem 'haml'
gem 'haml-rails'
# Twitter Bootstrap
gem 'bootstrap-sass'
require 'rbconfig'
gem 'wdm', '>= 0.1.0' if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
# HMTL 5 support
gem 'modernizr-rails'
# More icons!
#gem "font-awesome-rails"
# http://rubydoc.info/gems/bootstrap-datepicker-rails/1.0.0.7/frames
gem 'bootstrap-datepicker-rails'
gem 'tzinfo-data'
# Sample data
gem 'faker', '1.1.2'
# Pagination
gem 'will_paginate', '~> 3.1.0'
gem 'bootstrap-will_paginate'
# Turbolinks https://github.com/rails/turbolinks#turbolinks
# http://railscasts.com/episodes/390-turbolinks
gem 'turbolinks'
gem 'jquery-turbolinks'
# https://github.com/rails/strong_parameters
# gem 'strong_parameters'
# http://railscasts.com/episodes/314-pretty-urls-with-friendlyid?view=asciicast
gem 'friendly_id'
# http://railscasts.com/episodes/324-passing-data-to-javascript?view=asciicast
gem 'gon'
gem 'cloudinary'
As one of the answers point, I have tried too with git pull heroku master and it returns:
From https://git.heroku.com/keepmefit
* branch master -> FETCH_HEAD
* [new branch] master -> heroku/master
Already up-to-date.
Also git push -f heroku master and the output is the same as using git push heroku master so the error is still there and the push is rejected.
Any help is appreciated.

It seems that the stack (cedar-14 or cedar) is a really old one. Upgrading the stack to Heroku-16 will solve the issue.

It looks like you heroku remote is conflicting with the files you are trying to push (after your upgrade). You have two options
1 - Clean / merge up with your new changes the heroku remote and push again
git pull heroku master
Fix any conflicts / clean up etc..
git push heroku master
2 - Force push your new changes
NOTE: THIS ACTION WILL OVERRIDE WHAT YOU CURRENTLY HAVE IN HEROKU. So make sure that you dont need any changes that are already on heroku.
git push -f heroku master

Related

! Failed to install gems via Bundler Heroku Rails

I'm super new to RoR and am attempting to deploy my app on heroku. I'm getting the error you can see in the title.
Gemfile:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.0'
gem 'mail_form'
gem 'figaro'
gem 'rails', '~> 6.1.0'
# gem 'sqlite3', '~> 1.4'
gem 'puma', '~> 5.0'
gem 'sass-rails', '>= 6'
gem 'webpacker', '~> 5.0'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.7'
gem 'bootsnap', '>= 1.4.4', require: false
gem 'devise', '~> 4.7', '>= 4.7.3'
gem 'pg'
group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
gem 'web-console', '>= 4.1.0'
gem 'rack-mini-profiler', '~> 2.0'
gem 'listen', '~> 3.3'
gem 'spring'
end
group :test do
gem 'capybara', '>= 3.26'
gem 'selenium-webdriver'
gem 'webdrivers'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Stack
Enumerating objects: 424, done.
Counting objects: 100% (424/424), done.
Delta compression using up to 8 threads
Compressing objects: 100% (391/391), done.
Writing objects: 100% (424/424), 265.61 KiB | 6.18 MiB/s, done.
Total 424 (delta 193), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-18 stack
remote: -----> Determining which buildpack to use for this app
remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote: Detected buildpacks: Ruby,Node.js
remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.2.16
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.7.0
remote: -----> Installing dependencies using bundler 2.2.16
remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote: Unable to find a spec satisfying nokogiri (>= 1.8.5) in the set. Perhaps the
remote: lockfile is corrupted? Found nokogiri (1.11.7-x86_64-darwin), nokogiri
remote: (1.11.7-x86_64-darwin), nokogiri (1.11.7-x86_64-darwin), nokogiri
remote: (1.11.7-x86_64-darwin), nokogiri (1.11.7-x86_64-darwin) that did not match the
remote: current platform.
remote: Bundler Output: Unable to find a spec satisfying nokogiri (>= 1.8.5) in the set. Perhaps the
remote: lockfile is corrupted? Found nokogiri (1.11.7-x86_64-darwin), nokogiri
remote: (1.11.7-x86_64-darwin), nokogiri (1.11.7-x86_64-darwin), nokogiri
remote: (1.11.7-x86_64-darwin), nokogiri (1.11.7-x86_64-darwin) that did not match the
remote: current platform.
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
I have gone through every previous question on here and tried all the solutions.
I have already tried to delete the gemfile.lock and run bundle install again to reset it. I have done various git add, commits and pushes. I'm kind of at a loss of where to go from here. Any advice would be super appreciated.
nokogiri (1.11.7-x86_64-darwin) is native gem for Darwin/MacOS, but Heroku run Linux so that it unable to find.
the solution is avoid-using-a-precompiled-native-gem, in your case, bundler version 2.2.+, then you'll need to run bundle config set force_ruby_platform true
you should re-check that Gemfile.lock does not contain nokogiri (1.11.7-x86_64-darwin), it should contain nokogiri (~> ...)
I came across the same issue on the M1 Macbook. I deleted the Gemfile.lock, then ran bundle install to re-build the Gemfile.lock and this fixed the above error.
Running bundle update nokogiri updated only the Nokogiri gem dependencies for me without updating the rest of the Gemfile

Push to Heroku fails: Could not find net-ssh-2.10.0 in any of the sources. Failed to install gems via Bundler

I tried pushing my app to heroku but get the following error:
remote: -----> Using Ruby version: ruby-2.2.2
remote: -----> Installing dependencies using 1.9.7
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Fetching gem metadata from https://rubygems.org/...........
remote: Fetching version metadata from https://rubygems.org/...
remote: Fetching dependency metadata from https://rubygems.org/..
remote: Could not find net-ssh-2.10.0 in any of the sources
remote: Bundler Output: Fetching gem metadata from https://rubygems.org/...........
remote: Fetching version metadata from https://rubygems.org/...
remote: Fetching dependency metadata from https://rubygems.org/..
remote: Could not find net-ssh-2.10.0 in any of the sources
remote: ! Failed to install gems via Bundler.
remote: ! Push rejected, failed to compile Ruby app
What can I do about this?
I've removed Gemfile.lock to see if rebuilding this file would make a difference, but it didn't. Also, I've tried gem uninstall net-ssh-2.10.0 and then bundle install before pushing to heroku. Also, I removed fog from my Gemfile since that's the gem with which net-ssh-2.10.0 comes along; then did bundle update, gem cleanup, put fog back in the Gemfile, ran bundle install, pushed to git, and pushed to heroku with again the same result.
My Gemfile:
source 'https://rubygems.org'
ruby '2.2.2'
gem 'rails', '4.2.3'
gem 'bcrypt', '3.1.10'
gem 'faker', '1.4.3'
gem 'carrierwave', '0.10.0'
gem 'mini_magick', '4.2.9'
gem 'fog', '1.32.0'
gem 'aws-sdk', '2.1.11'
gem 'sass-rails', '5.0.3'
gem 'bootstrap-sass', '3.3.5.1'
gem 'uglifier', '2.7.1'
gem 'coffee-rails', '4.1.0'
gem 'wice_grid', '3.5.0'
gem 'bootstrap-datepicker-rails', '1.4.0'
gem 'friendly_id', '5.1.0'
gem 'jquery-rails', '4.0.4'
gem 'turbolinks', '2.5.3'
gem 'jbuilder', '2.3.1'
gem 'sdoc', '0.4.1', group: :doc
gem 'pg', '0.18.2'
group :production do
gem 'rails_12factor', '0.0.3'
gem 'puma', '2.11.2'
end
It seems that this version just has been removed from Rubygems...
May we have to do a downgrade or an upgrade...
The cause of deletion is here.
Add to your Gemfile:
gem 'net-ssh', '!= 2.10.0'
And run:
bundle update net-ssh

Can't Push To Heroku (Can't find Rake 10.3.2)

rails newbie here. I'm working through the tutorial on railstutorial.org on a Ubuntu 14.04 virtual machine. It's been pretty smooth sailing up until I got to heroku. When I want to push my app to heroku, it complains that it could not find rake-10.3.2. I checked heroku, and the application seems to be empty. However, I have rake-10.3.2 in my application, and if use "bundle show rake", it shows the correct version.
brandon#brandon-virtualbox:~/rails_projects/first_app$ bundle show rake
/home/brandon/.rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/gems/rake-10.3.2
That looks okay, but when I try to push it to heroku, I get:
brandon#brandon-virtualbox:~/rails_projects/first_app$ git push heroku master
Initializing repository, done.
Counting objects: 66, done.
Compressing objects: 100% (55/55), done.
Writing objects: 100% (66/66), 14.46 KiB | 0 bytes/s, done.
Total 66 (delta 6), reused 0 (delta 0)
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using 1.6.3
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Could not find rake-10.3.2 in any of the sources
Bundler Output: Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Could not find rake-10.3.2 in any of the sources
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby app
To git#heroku.com:dry-springs-4465.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:dry-springs-4465.git'
I noticed that it's using version 2.0.0 (which I have installed), but it's attempting to install the dependencies using 1.6.3. I'm not sure if that is related to the issue or not. My Gemfile is here:
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.8'
group :development do
gem 'sqlite3', '1.3.8'
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
I've been messing with it for a while, and have had no luck. I'm using RVM as well, but I'm a total newbie so I'm not sure what kind of impact that would have. If anyone would know what's going on, I'd appreciate it!
Thanks!
In my case, this was caused because I had some gems, but not all of them, under version control in vendor/cache. It seems that when vendor/cache is present, Heroku will not go to any of the other sources.
I solved this problem by moving the gem that I needed cached to another location, and then removing the vendor/cache folder from version control.

Heroku: Bundler intermittently fails with OpenSSL::SSL::SSLError: SSL_read:: decryption failed or bad record mac

My rails app, for some unknown reason, will fail to push to Heroku 29/30 times. It will fail on different gems, but always with the same error: OpenSSL::SSL::SSLError: SSL_read:: decryption failed or bad record mac. Does anyone have any ideas?
I've read about this error in other contexts, but at the point of the bundler I feel like there is very little I can do about it…
Logs for heroku push:
Counting objects: 35, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (21/21), done.
Writing objects: 100% (21/21), 2.55 KiB, done.
Total 21 (delta 19), reused 0 (delta 0)
-----> Removing .DS_Store files
-----> Fetching custom git buildpack... done
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
Fetching source index from https://rubygems.org/
Using i18n (0.6.1)
Using builder (3.0.4)
Using multi_json (1.8.2)
Using journey (1.0.4)
Using hike (1.2.3)
Using tilt (1.4.1)
Using rake (10.1.0)
... <<truncated for brevity>>
Using chunky_png (1.2.9)
Using httpauth (0.2.0)
Using kgio (2.8.1)
Using memcachier (0.0.2)
Using http_parser.rb (0.5.3)
OpenSSL::SSL::SSLError: SSL_read:: decryption failed or bad record mac
Using libxml-ruby (2.7.0)
Using newrelic_rpm (3.6.8.168)
Using libv8 (3.11.8.17)
An error occurred while installing modernizr-rails (2.6.3), and Bundler cannot
continue.
Make sure that `gem install modernizr-rails -v '2.6.3'` succeeds before
bundling.
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby app
Gemfile:
source 'https://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.13'
gem 'pg'
gem 'koala'
gem 'unicorn', '~> 4.6.3'
gem 'asset_sync'
gem 'json'
gem 'omniauth-facebook'
gem 'twitter', :git => 'git://github.com/sferik/twitter.git', :tag => 'v5.0.0.rc.1'
gem 'twitter-text'
gem 'typus'
gem 'certified'
gem 'taps'
gem 'kaminari'
gem 'rack'
gem 'mobile-fu'
gem 'newrelic_rpm', '~> 3.6.8.168'
# gem 'td'
gem 'libxml-ruby'
# gem 'rails_12factor', group: :production
gem 'mandrill-api'
# gem 'cocoon'
gem 'delayed_job_active_record'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'noty-rails'
gem 'add-to-homescreen-rails'
gem 'less-rails'
gem 'therubyracer'
gem 'libv8', '~> 3.11.8'
gem 'modernizr-rails'
gem 'compass-rails'
gem 'zurb-foundation'
gem 'foundation-icons-sass-rails'
gem 'momentjs-rails'
gem 'bourbon'
gem 'jquery-mobile-rails'
gem 'dalli'
gem 'memcachier'
end
group :test do
gem 'sqlite3'
gem 'simplecov'
end

Heroku push rejected, Ruby Version Changed Detected, Could not find net-scp-1.0.6

I can't figure out what is going on here. I deployed to Heroku on Tuesday with no problem. I have not changed my Ruby version locally or on the Gemfile but heroku is telling me that I have changed Ruby Versions & it's unable to find net-scp-1.0.6. Everything works perfectly locally, I have search around and can't find anything addressing a similar problem.
Counting objects: 81, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (62/62), done.
Writing objects: 100% (62/62), 10.77 KiB, done.
Total 62 (delta 49), reused 0 (delta 0)
-----> Deleting 8 files matching .slugignore patterns.
-----> Removing .DS_Store files
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using Bundler version 1.3.0.pre.5
Ruby version change detected. Clearing bundler cache.
Old: ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
New: ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Could not find net-scp-1.0.6 in any of the sources
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
This is what my Gemfile looks like.
source 'https://rubygems.org'
ruby '1.9.3'
gem 'rails', '~> 3.2.11'
gem 'aws-sdk'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'pg'
gem 'thin'
gem 'best_in_place'
gem 'stripe'
gem 'paperclip'
gem 'coffeebeans'
gem 'mail'
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'carmen'
gem 'haml'
gem 'devise'
gem 'sinatra', '~> 1.3.2'
gem 'dynamic_form'
gem 'fog', '~> 1.3.1'
gem 'wicked'
gem 'lazy_high_charts', '~> 1.1.5'
gem 'jquery-datatables-rails'
gem 'sass-rails'
group :assets do
gem 'uglifier', '>= 1.0.3'
gem 'coffee-rails', '~> 3.2.1'
end
group :test, :development do
gem 'hirb'
end
Any ideas would be appreciated. Thanks.
The net-scp-1.0.6 gem was yanked recently.
Locally, run:
gem cleanup
bundle update
Then commit and push, it will update net-scp to the latest version and you'll be fine.
Looks like I figured this out. This issue was caused by net-scp being yanked from Ruby Gems due to security concerns. I followed the instructions on this Fog issue (https://github.com/fog/fog/issues/1561) and locked net-scp down to 1.0.4 and life is back in order.

Resources