Heroku missing required flag when restoring database - heroku

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.

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.

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.

Related

How to add -a -app in my Websockets file?

I've got a problem when I upload my project on Heroku. I've trying changing value of socket.io and MongoUrl, but I get this error:
Error: Missing required flag:
› -a, --app APP app to run command against
This has nothing to do with any of your files. It's an argument that you must provide to the Heroku CLI itself, e.g.
heroku config:set SOME_VARIABLE=some_value -a myapp
where myapp is the name of your Heroku app.
The -a / --app argument is required when heroku can't figure out what app to connect to, either bcause there is no Heroku remote configured or because there is more than one Heroku remote configured.
See also How to avoid the --app option with heroku CLI?

Error: Missing required flag: -a, --app APP app to run command against

I am new to Heroku and I keep getting the above error - everything looks good to go when I deploy in heroku, connect to my github repo etc.. but I keep getting this error.
Its a node/express app and works exactly as I'd like locally but it won't deploy. Any help would be appreciated.
For getting logs of particular heroku app, use:
heroku logs --app=app_name
For example: your app name is 'chatapp'
heroku logs -app=chatapp
just run the command with the --app flag, followed by the app name.
I like how the --app flag is "mandatory" according to the official documentation, but the lone usage example in the official documentation doesn't use the --app flag.
Anyway, it's not really mandatory. It's just implicit, usually. You have to tell Heroku which app you're using, with something like:
$ heroku git:remote -a your_app_name
and then it stops wondering which app to run these commands on.
you did not set git remote to your application, do that first by,
heroku git:remote -a your_app_name
To expand a little further on this (just for the benefit of other new users encountering a similar issue) - below is an example of a command you could enter in macOS Terminal:
heroku logs --tail --app yourexampleservername
If you have deployed yourexampleservername to Heroku, this should then display a log.

How to back up Heroku pg database from app itself?

From a remote shell, using the Heroku toolbelt, it's pretty easy to trigger a db backup with:
heroku pg:backups:capture --app my-app
But how can I do that from a script running on the app itself? Something triggered from the heroku scheduler or manually like:
heroku run node myScript.js --app my-app
I have psql available so maybe that's an option although I don't know where to write to.
I don't see a way to do this via API here: https://devcenter.heroku.com/articles/platform-api-reference

"Couldn't find that app." when running heroku commands in console

I'm trying to run commands for my heroku app in my console, but it keeps telling me "Couldn't find that app." even though when I run heroku apps in my console it tells me I have one app called worldofwarcraft-api
So heroku recognizes my app in the apps list, but I can't run any commands to access it. The line I want to run is
heroku ps:scale web=1 --app worldofwarcraft-api
I'm trying to troubleshoot why my API returns a 503 when I try to make a GET request to it. This is the fix the heroku faq told me to try, but it's just telling me it can't find my app.
I'm wondering if it has something to do with the fact that I deployed my API from github, rather than running the heroku setup in my console. I don't know if that would effect my ability to run heroku commands on the app in my local console.
Apologies if my formatting is off a bit. I'm still getting used to this site.
In my case, someone renamed GitHub repo and I tried to find Heroku app with new GitHub name
It helps me
heroku apps
heroku git:remote -a YOUR_APP
Solved it. Just sharing for future searches.
The issue was fixed by running git init and then heroku git:remote -a worldofwarcraft-api in my command line while inside my repositories folder. This initialized git in the repo and then set the heroku git remote to that repository.
Hopefully, this helps anyone else who had a similar issue.
Just an easy way to solve this issue:
1st: Add the command into your terminal: $ heroku apps
If you already logged into your heroku account from your terminal, all your apps will appear as a list like this:
your-project-name-1
your-project-name-2
your-project-name-3
your-project-name-4
2nd: Then chose which one you are needing to connect with the following command:
$ heroku git:remote -a your-project-name-2
If you've done the connection properly you'll receive the following output:
set git remote heroku to https://git.heroku.com/your-project-name-2.git
For my case, I was renaming my github repository.
You can find it in your repository settings then just rename it, it appears in the first place.
Then you can continue with git init again to re-initiate your existing git repository and then set your heroku remote with your heroku apps new name heroku git:remote -a YOUR_APP_NAME
If the app belongs to a team that you participate in, you have to specify the team option in the commands to see the app:
E.g:
heroku apps -t <team name>
or
heroku ps:scale web=1 --app worldofwarcraft-api -t <team name>

Cannot get initialAdminPassword for jenkins on heroku

I am trying to get started with jenkins on heroku but I came across a problem is that now after deloying jenkins to heroku it wants to get the administrator password, and shows me this path /app/.jenkins/secrets/initialAdminPassword
I ssh'd into my heroku app and tried cat ( path ) but it shows there is no path like that on my heroku bash.
To set up my heroku server I followed this https://gist.github.com/jordansissel/2313443
I attached a picture of me trying in different ways
You can log out and then writeheroku logs --app yourappname
The password can be found there on the logs. If you cant see it, then restart the dynos.

Resources