Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to fetch tables information when running heroku db:pull

I have an application that uses postgres in development and production. I recently pushed to heroku and everything was working fine. I was able to pull the database from heroku and push back up with no problem. Today however, I tried to pull the DB down from heroku and I received this error

heroku db:pull

Loaded Taps v0.3.24
    Auto-detected local database: postgres://postgres:[email protected]/app_development?encoding=utf8
    Warning: Data in the database 'postgres://postgres:[email protected]/app_development?encoding=utf8' will be overwritten and will not be recoverable.

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

    > app
Receiving schema
Unable to fetch tables information from http://heroku:[email protected]. Please check the server log.

So I run heroku logs after:

james@james-Vostro-3550:~/Desktop/app$ heroku logs
2012-09-25T10:08:32+00:00 app[web.1]: Started GET "/users" for X.X.X.X at 2012-09-25 10:08:32 +0000
2012-09-25T10:08:32+00:00 heroku[router]: GET app.herokuapp.com/users? dyno=web.1 queue=0 wait=0ms service=38ms status=200 bytes=10727
2012-09-25T10:08:32+00:00 app[web.1]: 
2012-09-25T10:08:32+00:00 app[web.1]: 
2012-09-25T10:08:32+00:00 app[web.1]: Started GET "/application.css" for X.X.X.X at 2012-09-25 10:08:32 +0000
2012-09-25T10:08:32+00:00 app[web.1]: 
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2012-09-25T10:08:32+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/application.css"):
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/rack/logger.rb:26:in `call_app'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/rack/logger.rb:16:in `call'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/request_id.rb:22:in `call'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
2012-09-25T10:08:32+00:00 heroku[router]: GET app.herokuapp.com/application.css dyno=web.1 queue=0 wait=0ms service=6ms status=404 bytes=728
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/static.rb:62:in `call'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/engine.rb:479:in `call'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:220:in `call'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:78:in `catch'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:80:in `block in pre_process'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:53:in `process'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:78:in `pre_process'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:38:in `receive_data'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/backends/base.rb:63:in `start'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/server.rb:159:in `start'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/controllers/controller.rb:86:in `start'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/runner.rb:185:in `run_command'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/runner.rb:151:in `run!'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/bin/thin:6:in `<top (required)>'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/bin/thin:19:in `load'
2012-09-25T10:08:32+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/bin/thin:19:in `<main>'
2012-09-25T10:08:32+00:00 app[web.1]: 
2012-09-25T10:08:32+00:00 app[web.1]: 
2012-09-25T10:08:32+00:00 heroku[router]: GET app.herokuapp.com/assets/admin-e0756c8b3550bb800d5f58837c42ec80.css dyno=web.1 queue=0 wait=0ms service=7ms status=200 bytes=1941
2012-09-25T10:08:32+00:00 app[web.1]: 
2012-09-25T10:08:32+00:00 app[web.1]: 
2012-09-25T10:08:32+00:00 app[web.1]: Started GET "/assets/admin-e0756c8b3550bb800d5f58837c42ec80.css" for X.X.X.X at 2012-09-25 10:08:32 +0000
2012-09-25T10:08:41+00:00 app[web.1]: 
2012-09-25T10:08:41+00:00 app[web.1]: 
2012-09-25T10:08:41+00:00 app[web.1]: Started GET "/projects" for X.X.X.X at 2012-09-25 10:08:41 +0000
2012-09-25T10:08:41+00:00 heroku[router]: GET app.herokuapp.com/projects dyno=web.1 queue=0 wait=0ms service=31ms status=304 bytes=0
2012-09-25T10:08:41+00:00 app[web.1]: Started GET "/application.css" for X.X.X.X at 2012-09-25 10:08:41 +0000
2012-09-25T10:08:41+00:00 app[web.1]: 
2012-09-25T10:08:41+00:00 app[web.1]: 
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2012-09-25T10:08
:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/request_id.rb:22:in `call'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
2012-09-25T10:08:41+00:00 app[web.1]: 
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
2012-09-25T10:08:41+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/application.css"):
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/rack/logger.rb:26:in `call_app'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/rack/logger.rb:16:in `call'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/static.rb:62:in `call'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:220:in `call'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/server.rb:159:in `start'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:78:in `catch'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/engine.rb:479:in `call'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:80:in `block in pre_process'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:53:in `process'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/backends/base.rb:63:in `start'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:78:in `pre_process'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:38:in `receive_data'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/runner.rb:151:in `run!'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/runner.rb:185:in `run_command'
2012-09-25T10:08:41+00:00 app[web.1]: 
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/bin/thin:19:in `<main>'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/controllers/controller.rb:86:in `start'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/bin/thin:6:in `<top (required)>'
2012-09-25T10:08:41+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/bin/thin:19:in `load'
2012-09-25T10:08:41+00:00 app[web.1]: 
2012-09-25T10:08:41+00:00 heroku[router]: GET app.herokuapp.com/application.css dyno=web.1 queue=0 wait=0ms service=9ms status=404 bytes=728
2012-09-25T10:11:00+00:00 heroku[run.1]: Awaiting client
2012-09-25T10:11:00+00:00 heroku[run.1]: Starting process with command `bundle exec rake db:migrate`
2012-09-25T10:11:00+00:00 heroku[run.1]: State changed from starting to up
2012-09-25T10:11:06+00:00 heroku[run.1]: Client connection closed. Sending SIGHUP to all processes
2012-09-25T10:11:07+00:00 heroku[run.1]: Process exited with status 1
2012-09-25T10:11:07+00:00 heroku[run.1]: State changed from up to complete
2012-09-25T10:08:23+00:00 heroku[web.1]: State changed from starting to up
2012-09-25T10:08:01+00:00 heroku[web.1]: Unidling
2012-09-25T10:08:01+00:00 heroku[web.1]: State changed from down to starting

I have no idea where to look for a solution, so hopefully someone can help. I've just started learning rails so please remember this when trying to help.

Thanks in advance.

EDIT:

I have tried all sorts: reinstalling heroku, taps. remade my app and pushing to heroku. reinstalled postgres.

Nothing seems to work. Driving me mad!

like image 217
Jazz Avatar asked Sep 25 '12 10:09

Jazz


People also ask

How do I pull a database from Heroku to local disk?

Then use the “db:pull” command to pull your database down from your Heroku app to your local workstation: This loads the schema, data, indexes and sequences of the remote Heroku database down into the local database specified in config/database.yml.

How does Heroku notify users of upcoming changes to endpoints?

For stable endpoints, Heroku communicates upcoming incompatible changes to all users at least 30 days before their deployment. This notification includes the nature of the change, the reasoning behind it, and steps you must take to migrate from the old to the new behavior. This document also includes these details for the 30-day duration.

What is Heroku connect and how to use it?

Heroku Connect provides an API to automate the creation, maintenance, and monitoring of sync operations between Salesforce and a Heroku PostgreSQL database. A good way to work with the Heroku Connect API is to use the Heroku Connect CLI plugin.

What happens when Heroku authentication is complete?

When authentication is complete, it redirects the user to the url provided in the next parameter, or the Heroku Connect dashboard if it wasn’t provided. Pause an active connection to prevent data sync.


3 Answers

I found some kind of work-around.
I have the same problem with my SHARED_DATABASE on heroku
ruby 1.9.2
gems:
pg (0.11.0)
heroku (2.32.4)
heroku-api (0.3.5)
taps (0.3.24)
heroku db:pull ended with:
Unable to fetch tables information from http://[email protected]. Please check the server log.

I switched to ruby 1.8.7 using rvm and heroku db:pull works fine.
Back again to ruby 1.9.2 to develop my application.

I hope this help someone until db:pull will be fixed with ruby 1.9.2.

like image 88
sufleR Avatar answered Oct 12 '22 19:10

sufleR


MySQL

(Instructions for PostgreSQL are further down the page)

A temporary workaround would be to directly dump the data from your DB server and load it manually yourself. I have both databases (on Heroku and locally) in MySQL, so I did:

1. mysqldump -h host -P port_number -u user_name_to_your_db -p your_db_name > data.sql

Once you run the above command with correct details you will be asked to enter your password.

NOTE: Never put your password into your shell command as it is being stored in shell commands history.

Get your username, password, your_db_name, host and port_number from Heroku config:

2. heroku config --app your-app-name | grep DATABASE_URL

Your DATABASE_URL will look like this:

mysql2://username:password@host:port_number/your_db_name

An example of a bit more real DATABASE_URL will look like this (the login details there are modified):

mysql2://afdgsdfghliue:[email protected]:5432/9twgsenr8543

In that case the details would be respectively (remember, these are fake ones):

username: afdgsdfghliue:ESIJAFDG
password: ESIJAFDG-sAFsgiags3464
host:     ec2-34-15-23-232.compute-2.amazonaws.com
port:     5432
database: 9twgsenr8543

When you run the mysqldump with correct details as shown in 1. you will have your data stored in data.sql locally. Now to load it to your local database (we are still talking about MySQL) you will need to run:

mysql -u your_local_db_username -h 127.0.0.1 -p your_local_db_name < data.sql

The local database login details you should have.

PostgreSQL

I haven't checked the below instructions myself, so please use them together with your brain ;-)

I found from

pg_dump --help 

that you could run similar commands to dump your PostgreSQL database from Heroku like this:

pg_dump -h host -p port -U username -W your_db_name > data.sql

Your DATABASE_URL will start with postgres:

postgres://username:password@host:port_number/your_db_name

Based on

psql --help

here is how to load your local PostgreSQL database from the data.sql file prepared above:

psql -h 127.0.0.1 -U your_local_db_username -W -d your_local_db_name -f data.sql

A bit of manual process, but it at least gets you going.

like image 2
JjP Avatar answered Oct 12 '22 20:10

JjP


I just received an answer from heroku. They said that they were having some issues with taps and that it is working again now.

I checked and I confirm that it's working for me.

Rgds,

like image 2
ndemoreau Avatar answered Oct 12 '22 18:10

ndemoreau