user2498975
user2498975

Reputation: 129

Heroku missing required flag when restoring database

I've seen a couple of SO posts, and despite googleing and the heroku --help, I keep getting the same error

I've been working off of this: https://devcenter.heroku.com/articles/heroku-postgres-import-export

$ heroku pg:backups:restore 'secure-file-location-url' DATABASE_URL --app heroku-app-name --confirm heroku-app-name
Starting restore of secure-file-location-url to postgresql-flat-47715... done

Use Ctrl-C at any time to stop monitoring progress; the backup will continue restoring.
Use heroku pg:backups to check progress.
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 r018 for more details.
$ heroku pg:backups:info r018
 ›   Error: Missing required flag:
 ›     -a, --app APP  app to run command against
 ›   See more help with --help

My secure-file-location-url is a public Google Drive link, which I can access in an incognito browser window.

Upvotes: 0

Views: 804

Answers (2)

Tori
Tori

Reputation: 63

I ran into this problem as well, how I solved it was by adding run to the Heroku CLI command. Formatted like so: heroku pg:backups:restore '<signed url>' DATABASE_URL -a <your-application-name> Literally, put DATABASE_URL in there and it will read it from your environment variables. If you try putting in the postgress address it will fail. Also, the application needs to be the last thing added to this command, order matters here.

Upvotes: 0

Chris
Chris

Reputation: 136918

As discussed in the comments, your database dump is being hosted on Google Drive and the link you're providing goes to a viewer with a "download file" button.

Instead, you must provide a direct link to the file. The documentation recommends using Amazon S3.

Upvotes: 1

Related Questions