Search code examples
ruby-on-rails-3githerokumigrationtaps

404 error on heroku db:push


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


Solution

  • 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.