Reputation: 2813
I'm having an issue with a ruby on rails app that I have hosted on Heroku
.
No matter what I push to the repo, I get an Internal Server Error
string presented to me with no additional information on what I did wrong.
Every change that I decide to make will work great locally, but I can't seem to avoid causes this Internal Server Error
every time I push. I have to keep rolling back and figure out what I need to fix to make this stop happening.
Does anyone have a suggestion for me?
I rolled back the repo to a stable changeset, and then I cloned the repo to another directory on my machine. I made a small change to a javascript file to fix a minor bug, and even that push caused the site to go down and give the Internal Server Error
message. Is something wrong with my environment?
For those who have recently gave answers, please review the comments to the question as some of your suggestions have already been addressed. Thanks!
I'll have to admit that I still don't understand why things were behaving the way they were, but a commit that seemed to be pushed just fine without breaking the site included a ternary operator that Rubymine didn't seem to mind. After a certain point, every commit caused this Internal Server Error
thereafter. But after converting the ternary operator back to an if-else-end
conditional statement, this behavior ceased. I hope that this helps someone with a similar issue in the future, albeit obscure.
Upvotes: 2
Views: 3260
Reputation: 13054
The main problem I see from the logs is
!! Unexpected error while processing request: can't modify frozen array
A quick Google search for "rails production can't modify frozen array" gave this related question on SO (also about heroku.)
Other things you can do:
heroku run script/rails console
and look out for errors.rake db:load_schema
, rake assets:precompile
, and rails s
with the RAILS_ENV=production
prefix. Make sure you are using thin
.(Actually if you did 3. and it still works on your local machine, it's time to contact Heroku support.)
Let's call your current repo project.git
. Make a copy of this repo, and rename the master branch to future
. Checkout the earliest working commit of future
into the master branch of your new repo, and create a new Heroku app. Push and test.
Keeping doing that until you find the exact commit that introduced the bug. This takes a long time. git bisect might be useful.
Upvotes: 2
Reputation: 3283
If rails console on the heroku server works, then Rails seems to be booting up okay ?
Did you actually run rails console on heroku without errors, or just the same error ?
Have you tried running the rails server on production mode locally ?
rails server -e production
Personally, instead of hunting around with no extra information other than Internal Server Error, I'll make sure that I'm signed up to an error service like Airbrake [1] or setup Exception Notifier [2]
[1] https://addons.heroku.com/airbrake
[2] https://github.com/smartinez87/exception_notification
Upvotes: 0
Reputation: 1657
In your terminal, run heroku logs --tail Then from other terminal run the push command and see what is going on
Upvotes: 1