Can't deploy rails app to Heroku due to a security issue - ruby-on-rails

I tried deploying it multiple times but got the same error. I'm new to ruby on rails and have no idea how to solve it. I tried cloning it locally and changing the file to read "config.assets.compile = false" instead of true. That didn't work either. Any ideas? Here's the link to the git repository I'm trying to download. Let me know if I need to be more specific about anything. Thanks for all the help!
There was an issue building your app. This can mean your app.json's project is not a valid Heroku application. Please ensure your app is deployable to Heroku and try again.
-----> Installing node-v8.10.0-linux-x64
Detected manifest file, assuming assets were compiled locally
-----> Detecting rails configuration
sh: 2: config.assets.compile: not found
!
! A security vulnerability has been detected in your application.
! To protect your application you must take action.
Your application
! is currently exposing its credentials via an easy to exploit
directory
! traversal.
!
! To protect your application you must either upgrade to
Sprockets version "3.7.2"
! or disable dynamic compilation at runtime by setting:
!
! ! config.assets.compile = false # Disables security
vulnerability !
!
! Push rejected, failed to compile Ruby app.
! Push failed

This should work:
bundle update sprockets

Alternatively to updating sprockets with bundle update sprockets, you can disable config.assets.compile in config/environments/production.rb.
For more information, Heroku published a very detailed blog post on this subject: https://blog.heroku.com/rails-asset-pipeline-vulnerability

Related

Pushing to Heroku fails because it wont detect my app type/buildpack

I am trying to push the first version of a Ruby on Rails app to Heroku.
When I run git push heroku master the errors I get are:
remote: -----> Failed to detect app matching no buildpack
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/myapp'
Since no buildpack was detected, I tried to set it manually. When I run heroku buildpacks I get Buildpack URL heroku/ruby, but I still get the same error.
I checked this solution and my gemfile is present, my ruby version in the gemfile is defined and my gemfile.lock has the railties gem.
Heroku logs just regurgitate the errors above so it wasn't helpful
Any suggestions for what else my be wrong?
Did you try putting the putting ruby version number on top of the GemFile.
ruby '<your ruby version>'
the following line above should be at the top of gemfile. Also make sure you have Gemfile and Gemfile.lock files committed, those will be checked upon pushed to heroku servers.
Did you commit the app to the Git Index?
The Gemfile and Gemfile.lock are probably indexed but not yet commited.
You need to have the rails project at the root. If it's not, Heroku will not know the entry point.
So this: somefolder/my_rails_app will not work.

Heroku application error - Gemfile.lock?

I keep running into the application error on Heroku website after I write git push heroku master. Does this have something to do with this?:
WARNINGS:
Removing 'Gemfile.lock' because it was generated on windows.
Bundler will do a full resolve so native gems are handled properly.
This may result in unexpected gem versions being used in your app.
In rare occasions Bundler may not be able to resolve your dependencies at all.
and if so how do I fix it?
Thanks in advance
Edit: http://gyazo.com/bc40680795ac3d7c7134fcf84d97c4a1

heroku slug compilation error failed to read buildpack metadata: error in release script

I edited some code and tried to push to heroku and all of a sudden received strange errors about slug compilation and now I can't push to heroku. I don't know what happened I didn't mess with anything out of the ordinary.
Slug compilation error: failed to read buildpack metadata: error in release script
Asset precompilation completed (47.59s)
-----> Rails plugin injection
Injecting rails_log_stdout
Injecting rails3_serve_static_assets
-----> Discovering process types
/usr/bin/env: ruby: No such file or directory
! Push failed: failed to read buildpack metadata: error in release script.
! If the problem persists, see http://help.heroku.com and provide ID 8e6d0ded-66b7-4696-a204-2a2f0fdf6e57.
To git#heroku.com:apollojive.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:apollojive.git'
EDIT: Looks like this problem has been fixed. I was finally able to deploy
UPDATE: Appears to be fixed. Or at least I was able to push an update without error.
I'm seeing this error as well, but only when pushing to my "prod" app - not "stage". I guess it's time to take a break and eat some dinner :)
This has been resolved. It was an issue with a new release of the ruby buildpack and has since been resolved. You should be good to deploy to the platform now.
If you're still seeing this error, please do let us know by opening a support ticket. Thanks!
I believe it might have something to do with ruby version, since i was using 2.0.0-p0 (specified on Gemfile), and when I tried pushing I saw that it updated to a new version 2.0.0-p195, which has been recently released ( 14 may ).
There was this lines on Heroku log that suggested this:
Old: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
New: ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]
UPDATE:
I've changed ruby version on Gemfile to 1.9.3 ( did a bundle and commited Gemfiles ) and it works.

rails 3 heroku push master issue

when I push my rails 3 app git heroku master I get this error msg:
-----> Heroku receiving push
-----> Rails app detected
! Heroku Bamboo does not include any Rails gems by default.
! You'll need to declare it in either .gems or Gemfile.
! See http://docs.heroku.com/gems for details on specifying gems.
! Heroku push rejected, no Rails gem specified.
error: hooks/pre-receive exited with error code 1
To git#heroku.com:glowing-rain-62.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:glowing-rain-62.git'
I have gem 'rails', '3.0.3' specified in my gemfile, so I am not sure what the issue is....If anyone could help I would really appreciate it. Thanks..
Don't forget that Gemfile is case sensitive. Make sure the file is actually IN your repo. You should also have a Gemfile.lock file too. Which version of bundler are you running?
Have you successfully deployed to Heroku before?
If not you may want to double-check that rails, 3.0.3 is committed to your Git repo just as a sanity check...
I think the problem might be connected with the heroku server type (or idiomatically: stack). The normal stack (called Aspen, I think) is runned by Debian Etch which doesn't support newer versions of Rails (i.e. Rails 3) and neither Sinatra.
To solve the problem you can switch to the Bamboo stack which is runned by Debian Lenny. You can do it by switching the stack as followed:
heroku create yourname --stack bamboo-mri-1.9.2
"yourname" is of course the name of your application. After that it should work as it should.

push rails app to heroku

I am trying to push a rails application to heroku.
When I get to the last step:
git push heroku master
It doesn't work and gives me these errors:
Counting objects: 85, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (74/74), done.
Writing objects: 100% (85/85), 24.38 KiB, done.
Total 85 (delta 23), reused 0 (delta 0)
-----> Heroku receiving push
! Heroku push rejected, no Rails or Rack app detected.
error: hooks/pre-receive exited with error code 1
To git#heroku.com:smooth-dusk-26.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:smooth-dusk-26.git'
I don't know what I'm doing wrong :(
Here's the answer I got from Heroku and it worked for me (after trying different pg gems, adapters, and everything else on the 10 other posts about this)
1) add the line:
gem 'pg'
to your Gemfile.
2) Run the command bundle install to install the gem into your bundle.
3) Stage the Gemfile and Gemfile.lock changes:
git add Gemfile Gemfile.lock
4) Commit the changes:
git commit -m "Install the pg gem"
5) Redeploy to heroku:
git push heroku master
When you created your Rails application, did you change directory into the directory of the application? You have to perform all the commands from within the application's directory.
rails myapp
cd myapp
I encountered the same errors working through Chapter 1 of Michael Hartl's Rails Tutorial. They were eventually resolved by issuing another git commit command after opening a Heroku account and configuring the SSH keys: git commit -a -m "Heroku recommit"
git push heroku master then succeeded.
I just had the same problem trying to push my app to heroku and none of the above answers fixed it.
I solved the issue by emptying my RVM Gemset with rvm gemset empty, deleting my Gemfile.lock (probably best to just rename it) and reinstalling my gems. Pushing worked fine after this.
For me it was the presence of index.php that fixed it. Heroku seems to check for existence of index.php on pre-commit.
Got the same problem under windows following one of the guides on ror site. After making everything like here http://devcenter.heroku.com/articles/quickstart it was solved.
Seems like problem was because of missing two lines.
cd myapp
git init
Also, if you're on Rails 3.0 make sure you use the cedar stack
heroku create --stack cedar
I went through the Rails Tutorial and didn't have a single problem with Heroku (MAC OS X), but you do have to follow the directions.
First, make sure you add/commit to Git. Then if you're in a -b (branch) you need to checkout into master, then merge the branch. If you've made changes to assets, you need to rake asset:precompile.
If you're having a rack up issue, make sure you have this file => config.ru and the contents should look like this.
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run SampleApp::Application
I'm relatively new to Rails and Heroku, but as I mentioned above, if you're following the tutorial's directions, Heroku is a snap and the directions most definitely work. If not, I highly recommend getting started there!
enter link description here

Resources