0

this is the thing: Having a web application working on heroku, i built an api that should use the same database in order to feed mobile apps.

I used this solution to set the api's database_url like the web database_url, and it worked fine. Thou there's still also a default database heroku creates with the app. This is what "heroku config --app my_app" shows:

DATABASE_URL:              (..web database_url..)
HEROKU_POSTGRESQL_RED_URL: (..heroku default url..)
LANG:                      en_US.UTF-8
RACK_ENV:                  production
RAILS_ENV:                 production
SECRET_KEY_BASE:           ...

Anyway, the api works fine locally when i do this:

curl -H 'Content-Type: application/json'   -H 'Accept: application/json' -X POST http://my_app.herokuapp.com/users/sign_in   -d '{"user": {"email": "my_user@gmail.com", "password": "my_password"}}'

But when i try the same thing on heroku it shows the Error:

{"status":"500","error":"Internal Server Error"}

First time im trying something like this, so im not sure where to check. I'd appreciate any help.

UPDATE

This is the result of heroku logs:

2015-01-16T18:13:22.993278+00:00 heroku[router]: at=info method=POST
path="/users/sign_in" host=helphy-api.herokuapp.com 
request_id=23c47ee1-88aa-4ac8-a607-efee0a121c4c fwd="190.15.201.45" 
dyno=web.1 connect=1ms service=156ms status=500 bytes=330

Thanks in advance

Community
  • 1
  • 1
ntonnelier
  • 1,539
  • 3
  • 23
  • 49
  • Issue the query and then take a look at the log (run `heroku logs`). You should see the error in more detail. Post it here if still unsure what's causing it. – Jiří Pospíšil Jan 16 '15 at 17:33
  • Thanks @JiříPospíšil, that was the way to go. Thou i didnt get much from the log: 2015-01-16T17:39:55.597543+00:00 heroku[router]: at=info method=POST path="/users/sign_in" host=my_api.herokuapp.com request_id=14e79452-cf45-4bce-8296-b0fecaadea02 fwd="190.15.201.45" dyno=web.1 connect=1ms service=114ms status=500 bytes=330 – ntonnelier Jan 16 '15 at 17:43

0 Answers0