Question

I have a local psql database dump that needs to be uploaded to heroku. I followed the steps in the Update section from this link. Everything worked fine until the last part, the actual uploading step:

heroku pgbackups:restore --app myAppName DATABASE 'https://www.dropbox.com/myAppPSQLDumpLink/myAppName_local.dump' --confirm myAppName

This was what was showing up in the console:

HEROKU_POSTGRESQL_SILVER_URL (DATABASE_URL)  <---restore---  myAppName_local.dump

Retrieving... done

 !    An error occurred and your restore did not finish.

And this was the error from the logs (courtesy of Toby Hede's question):

2013-01-09T15:39:09+00:00 app[pgbackups]: Invalid dump format: /tmp/GgUz5yU4bF/project_mgr_development_local.dump: HTML document text

I tried searching for this error, but could not find an answer. Does anyone know what needs to be done to solve the problem? The actual dump for my local psql database was performed this way:

pg_dump -Fc --no-acl --no-owner -U myUserName  > myAppName_local.dump

Thank you!

Was it helpful?

Solution

Looks like the link to the dump on Dropbox is redirecting or pointing to an HTML page (HTML document text in the error). Visit the link and make sure you are directly getting the dump. Or download the dump in your browser, right-click on it and Copy Download Link. That link should work with pgbackups:restore.

OTHER TIPS

Dropbox provides an explanation for directly downloading files (https://www.dropbox.com/en/help/201) This can be helpful for using the dropbox links in pg_backups.

In short it says to have the download link with option "dl=1" rather than "dl=0". But this didn't work for me. Even copying the the address of downloaded file didn't work for me.

If you face the above problems, try moving the file into the public folder and copy the link from there. This worked for me.

According to Importing and Exporting Heroku Postgres Databases with PG Backups, you can restore dump at terminal with:

$ curl -o latest.dump `heroku pgbackups:url --app heroku_appname`
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump

Got the same error, but different reason, so different solution. Maybe it helps someone.

If you've stored the dump file in a server with HTTPS, and you mistakenly used HTTP for the database URL, the forwarding will be interpreted as an HTML document.

So change

heroku pgbackups:restore --app myAppName DATABASE 'http://www.example.com/my.dump' --confirm myAppName

to

heroku pgbackups:restore --app myAppName DATABASE 'https://www.example.com/my.dump' --confirm myAppName
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top