Uploading my ruby on rails app to heroku causes the following error:
We're sorry, but something went wrong.
This does not occur on my local machine.
After some debugging, I think I may have spotted the error, but do not know how to fix it.
In my file application.html.erb, removing the following line solves the problem, but then my app loses its jquery mobile theme. Any ideas what I could do to fix the problem?
Line causing the problem:
<%= javascript_include_tag "application" %>
application.html.erb file:
<!DOCTYPE html>
<html>
<head>
<title>Washapp</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href=".0.1/jquery.mobile-1.0.1.min.css" />
<%= javascript_include_tag "application" %>
<script src=".0.1/jquery.mobile-1.0.1.min.js"></script>
<%= csrf_meta_tags %>
<script>
if (window.location.hash == "#_=_")
window.location.hash = "";
</script>
</head>
<body>
<div data-role="page">
<%= yield %>
</div>
</body>
</html>
Heroku logs:
2012-04-08T23:28:41+00:00 heroku[nginx]: 78.105.51.57 - - [08/Apr/2012:23:28:41 +0000] "GET / HTTP/1.1" 500 643 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.151 Safari/535.19" washappdelete2.heroku
2012-04-08T23:28:43+00:00 app[web.1]:
2012-04-08T23:28:43+00:00 app[web.1]: Started GET "/" for 78.105.51.57 at 2012-04-08 16:28:43 -0700
2012-04-08T23:28:43+00:00 app[web.1]:
2012-04-08T23:28:43+00:00 app[web.1]: Processing by HomeController#index as HTML
2012-04-08T23:28:43+00:00 app[web.1]: Rendered home/routa_list.html.erb within layouts/application (0.1ms)
2012-04-08T23:28:43+00:00 app[web.1]: Completed 500 Internal Server Error in 34ms
2012-04-08T23:28:43+00:00 app[web.1]:
2012-04-08T23:28:43+00:00 app[web.1]: 4: <title>Washapp</title>
2012-04-08T23:28:43+00:00 app[web.1]: ActionView::Template::Error (application.js isn't prepiled):
2012-04-08T23:28:43+00:00 app[web.1]: 5: <meta name="viewport" content="width=device-width">
2012-04-08T23:28:43+00:00 app[web.1]: 6: <link rel="stylesheet" href=".0.1/jquery.mobile-1.0.1.min.css" />
2012-04-08T23:28:43+00:00 app[web.1]: 7: <%= javascript_include_tag "application" %>
2012-04-08T23:28:43+00:00 app[web.1]: 9: <script src=".0.1/jquery.mobile-1.0.1.min.js"></script>
2012-04-08T23:28:43+00:00 app[web.1]: 8:
2012-04-08T23:28:43+00:00 app[web.1]: 10: <%= csrf_meta_tags %>
2012-04-08T23:28:43+00:00 app[web.1]: app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__2373145142857118006_42724320'
2012-04-08T23:28:43+00:00 app[web.1]: app/controllers/home_controller.rb:4:in `index'
2012-04-08T23:28:43+00:00 app[web.1]: cache: [GET /] miss
2012-04-08T23:28:43+00:00 app[web.1]:
2012-04-08T23:28:43+00:00 app[web.1]:
app/assets/javascripts/application.js
// This is a manifest file that'll be piled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the piled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
Repository:
Uploading my ruby on rails app to heroku causes the following error:
We're sorry, but something went wrong.
This does not occur on my local machine.
After some debugging, I think I may have spotted the error, but do not know how to fix it.
In my file application.html.erb, removing the following line solves the problem, but then my app loses its jquery mobile theme. Any ideas what I could do to fix the problem?
Line causing the problem:
<%= javascript_include_tag "application" %>
application.html.erb file:
<!DOCTYPE html>
<html>
<head>
<title>Washapp</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="http://code.jquery./mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<%= javascript_include_tag "application" %>
<script src="http://code.jquery./mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<%= csrf_meta_tags %>
<script>
if (window.location.hash == "#_=_")
window.location.hash = "";
</script>
</head>
<body>
<div data-role="page">
<%= yield %>
</div>
</body>
</html>
Heroku logs:
2012-04-08T23:28:41+00:00 heroku[nginx]: 78.105.51.57 - - [08/Apr/2012:23:28:41 +0000] "GET / HTTP/1.1" 500 643 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.151 Safari/535.19" washappdelete2.heroku.
2012-04-08T23:28:43+00:00 app[web.1]:
2012-04-08T23:28:43+00:00 app[web.1]: Started GET "/" for 78.105.51.57 at 2012-04-08 16:28:43 -0700
2012-04-08T23:28:43+00:00 app[web.1]:
2012-04-08T23:28:43+00:00 app[web.1]: Processing by HomeController#index as HTML
2012-04-08T23:28:43+00:00 app[web.1]: Rendered home/routa_list.html.erb within layouts/application (0.1ms)
2012-04-08T23:28:43+00:00 app[web.1]: Completed 500 Internal Server Error in 34ms
2012-04-08T23:28:43+00:00 app[web.1]:
2012-04-08T23:28:43+00:00 app[web.1]: 4: <title>Washapp</title>
2012-04-08T23:28:43+00:00 app[web.1]: ActionView::Template::Error (application.js isn't prepiled):
2012-04-08T23:28:43+00:00 app[web.1]: 5: <meta name="viewport" content="width=device-width">
2012-04-08T23:28:43+00:00 app[web.1]: 6: <link rel="stylesheet" href="http://code.jquery./mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
2012-04-08T23:28:43+00:00 app[web.1]: 7: <%= javascript_include_tag "application" %>
2012-04-08T23:28:43+00:00 app[web.1]: 9: <script src="http://code.jquery./mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
2012-04-08T23:28:43+00:00 app[web.1]: 8:
2012-04-08T23:28:43+00:00 app[web.1]: 10: <%= csrf_meta_tags %>
2012-04-08T23:28:43+00:00 app[web.1]: app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__2373145142857118006_42724320'
2012-04-08T23:28:43+00:00 app[web.1]: app/controllers/home_controller.rb:4:in `index'
2012-04-08T23:28:43+00:00 app[web.1]: cache: [GET /] miss
2012-04-08T23:28:43+00:00 app[web.1]:
2012-04-08T23:28:43+00:00 app[web.1]:
app/assets/javascripts/application.js
// This is a manifest file that'll be piled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the piled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
Repository: https://github./karangb/herokuProblem
Share Improve this question edited Apr 9, 2012 at 0:00 Karan asked Apr 8, 2012 at 23:19 KaranKaran 15.1k26 gold badges95 silver badges157 bronze badges 7- What version of rails are you using? Could be related to the asset pipeline. Assets are included differently depending on what environment you are in. guides.rubyonrails/asset_pipeline.html – benjgorman Commented Apr 8, 2012 at 23:21
- I am running Rails 3.2.2 – Karan Commented Apr 8, 2012 at 23:22
- Yup it's to do with your assets pilation. Have a read of the link I posted. – benjgorman Commented Apr 8, 2012 at 23:23
-
1
Also
heroku logs
might be useful if you were not aware of it – Jonathan Commented Apr 8, 2012 at 23:26 - 1 you mean app/assets/javascripts/application.js? ive just updated my post with it – Karan Commented Apr 8, 2012 at 23:32
7 Answers
Reset to default 7Problem solved!
It was simple - taken from 500 internal server error when I try to push my app onto Heroku
So based upon the heroku info that you provided I see that you are on the bamboo stack and that stack does not support Rails 3.1+. Only the cedar stack supports Rails 3.1+. You'll need to use the following mand to create a new app on the cedar stack:
heroku create --stack cedar
In config/application.rb, add
config.assets.initialize_on_prepile = false
and push to git, then heroku push.
Try adding
//= require jquery.mobile
in your
app/assets/stylesheets/application.js
amd set
config.assets.pile = tue
in your
config/enviroments/production.rb
Try to set in config/enviroments/production.rb the following line to false:
config.assets.pile = false
If you have anything like like java within app/assets
, this will throw sprockets off. Naming it to something like applets instead will allow the contents of javascripts
directory to be piled. Source
Are you also setting
config.assets.initialize_on_prepile = false
This is a new change on Rails 3.2 (see the Docs)
Nevertheless, you should be able to see an error during the slug pilation (as example below, if you do not set the above flag)
-----> Preparing app for Rails asset pipeline
Running: rake assets:prepile
rake aborted!
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
You can also try to run the rake prepile task locally, and see the error (again, as the documentation is suggesting).
make sure there are no untracked files, do git status
maybe try, heroku run rake db:migrate