Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby

Adam Carter
Adam Carter
3,108 Points

Weird error after pushing to Heroku, newbie here...

Hi all! I've been doing the Rails tutorial, the Treebook app. I got it working on my localhost:3000, I registered a couple users and added friends and everything works fine. Followed all the steps, pushed to heroku.

On heroku, whenever you click to add someone as a friend, it says "We're sorry, but something went wrong.".....yet it works fine when I run it locally! It is so frustrating, after spending hours following along with the videos...I've googled and googled, tried all kinds of things...the heroku run rake db:setup command in terminal, I've done git add . and git commit, etc...really confused, any help would be appreciated!

Here is the heroku link, also: http://myfriends1.herokuapp.com/

4 Answers

Kenan Memis
Kenan Memis
47,314 Points

Hi,

Did you try to run heroku logs in order to see the error when clicked on "Add Friend" button?

It may give a clue about the problem, since without seeing logs or having no access to the code can not say much. On the other hand when you have everything fine on development while having errors on production, it is most probably either from a production config (including db config) or assets..

You can run heroku logs by

heroku logs --tail
Adam Carter
Adam Carter
3,108 Points

awesome thanks, I will try that now and see if I can find the error!

Stone Preston
Stone Preston
42,016 Points

if it works fine locally but not on heroku it may have something to do with postgres. Just a thought.

Try running $ run rake heroku db:migrate. I belive that's the command though I may be wrong. Basically you have to create and migrate your heroku db

Adam Carter
Adam Carter
3,108 Points

unfortunately that doesn't work :(

https://devcenter.heroku.com/articles/rake and dont forget to restart the heroku db after wards. your problem always happens to me when i deploy online