Postgresql – pg_restore: [archiver] did not find magic string in file header: please check the source URL and ensure it is publicly accessible

herokupg-dumppostgresql

I have been trying to push a dump file from my local Postgrel DB (which I uploaded into my Google Drive and is accessible to public) into my Heroku remote DB with the following URL:

heroku pg:backups:restore 'https://drive.google.com/open?id=dump_id_link_here' DATABASE_URL

I am already logged in into my Heroku app from the terminal on which I run the command.
but I got the same error twice. I have been searching online and found threads such as pg_restore: [archiver] did not find magic string in file header but I could not help link between the two, since I am very new two Postgrel. I Hope you guys point me out towards the issues. Very much appreciated.

Starting restore of https://drive.google.com/open?id=dump_id_link_here to postgresql-symmetrical-52186... done

Stop a running restore with heroku pg:backups:cancel.

Restoring... !
▸    An error occurred and the backup did not finish.
▸    
▸    waiting for restore to complete
▸    pg_restore finished with errors
▸    waiting for download to complete
▸    download finished with errors
▸    please check the source URL and ensure it is publicly accessible
▸    Run heroku pg:backups:info r002 for more details.


=== Backup r002
Database:         BACKUP
Started at:       2019-09-14 21:14:26 +0000
Finished at:      2019-09-14 21:14:27 +0000
Status:           Failed
Type:             Manual
Backup Size:      0.00B (0% compression)

=== Backup Logs
2019-09-14 21:14:27 +0000 pg_restore: [archiver] did not find magic string in file header
2019-09-14 21:14:27 +0000 waiting for restore to complete
2019-09-14 21:14:27 +0000 pg_restore finished with errors
2019-09-14 21:14:27 +0000 waiting for download to complete
2019-09-14 21:14:27 +0000 download finished with errors
2019-09-14 21:14:27 +0000 please check the source URL and ensure it is publicly accessible

Best Answer

So I have tried to use Dropbox and other services, but I had the same error until the tenth attempt. Here is what I did:

  1. I logged in to my with my Heroku cli from my terminal on the master branch so I don't have to redefine the app. (specify the path to your damp. I have mine on the same directory) e.g:

    [murph@ComputerX languageandcode]$

  2. the I run

    [murph@ComputerX languageandcode]$ heroku pg:psql < langandcode.sql

    Then I became happy as pushing started and completed successfully.