1

I am getting a 404 error when trying to push my database to Heroku via Taps

(1.9.2@[app_name]_db) heroku db:push --app [app_name]
Loaded Taps v0.3.24
Auto-detected local database: sqlite://db/development.sqlite3
Warning: Data in the app '[app-name]' will be overwritten and will not be recoverable.

 !    WARNING: Destructive Action
 !    This command will affect the app: [app-name]
 !    To proceed, type "[app-name]" or re-run this command with --confirm [app-name]

> [app-name]
Sending schema
Schema:          0% |                                          | ETA:  --:--:--
Saving session to push_201209251425.dat..
!!! Caught Server Exception
HTTP CODE: 404

The db:push command used to work fine, then I made some changes to my database by rolling back the migrations, editing them, and then re-migrating. Now I can deploy the app just fine, but the database will not push -- I don't know if this is related to editing the migrations or not.

The app works fine on my machine, and I wanted to eliminate any discrepancies between Heroku's copy and my own, so I created a new app and pushed to that. Same thing: the Heroku app works but will not receive db:push; it errors out with the same 404 above.

Is this a Heroku service temporarily down, or has changing my app caused the 404?

Edit: heroku logs do not show any error message

Tyler
  • 11,272
  • 9
  • 65
  • 105

3 Answers3

1

Heroku support was taking too long to respond, so I found a workaround that communicates with my EC2 instance directly by using the Taps gem.

  1. Go to Heroku dashboard for your database. For me this was at

    https://postgres.heroku.com/databases/[my-database-name]

    though I navigated by going through Addons.

  2. Click on 'URL' in 'Connection Settings', should give you something like

    postgres://[username]:[password]@ec2-[ip_address_numbers].compute-1.amazonaws.com:[port]/[database_name]

    Copy this value down, I'll reference it here as [EC2_URL]

  3. Get Taps installed on 1.9.2 gemset if you don't already have it (not sure if 1.9.3 will work, didn't test it)

  4. Set up localhost taps server to facilitate transaction by running in terminal:

    taps server postgres://[local_machine_username]@localhost/[name_from_database.yml] [some_username] [some_password]

    (note the spaces before username and password)

  5. Then you can process the transaction yourself through another terminal window:

    taps pull [EC2_URL] http://[some_username]:[some_password]@localhost:5000

It should run and pull all your data from the local development db to the Amazon instance. You can also do vice versa, or choose a different database, etc. Or not, I'm not a cop.

Tyler
  • 11,272
  • 9
  • 65
  • 105
0

There are some problems with heroku db commands and ruby 1.9.2 (I have this version).
db:pull ends with "Unable to fetch tables information from"
db:push ends with "!!! Caught Server Exception HTTP CODE: 404"

There is a work-around for this problem. Switch to ruby 1.8.7 (I am using rvm for this) for a moment just to do db operations on heroku and after finish switch ruby back.

sufleR
  • 2,865
  • 17
  • 31
  • Funny you should put it that way. I'm using 1.9.3, and my original workaround was to use 1.9.2! I have commands from above saved in a text file so I can deploy quickly without too much troubleshooting if Heroku's db:push goes offline again. – Tyler Sep 26 '12 at 21:17
0

I do the same process (have Heroku convert my sqlite database to Postgres), and I was getting this problem yesterday as well. It seems to be working now, so I'm believe it was an issue with Heroku.

Chris
  • 183
  • 1
  • 7