Heroku pg:info and pg:psql "Not found" - ruby-on-rails

I'm not sure what has happened to my heroku postgres but when I try to access it with command line with pg:info and pg:psql, I get "Not found".
I even clicked on the button on heroku to create a database for my app as well.
How do I debug this? What can I try? I don't mind starting from scratch since it's for testing.

It wants the psql installed and avalibale on the command line on your local machine. On Ubuntu, I ran sudo apt-get install postgresql-client . heroku pg:psql then worked straight away.

Try passing the appname or database name explicitly. The heroku cli tries to infer your application name from the 'heroku' git remote but if it can't find that it just returns the Not Found message.
eg;
heroku pg:info --app appname

If you are one OS X you should install postgres like this :
brew install postgres

See this. May be the same reason.
Heroku postgres not found

Related

coding with heroku and some addones and sendgrid function

Hi i am doing some coding with heroku and now i am running with some problem more specifically using this code in my terminal
sudo heroku addones:add sendgrid:starter --app project1
end result
Adding sendgrid:starter on project1... failed
! You do not have access to the app project1.
I am a bit new with ubuntu and ruby on rails so i dont have any god idea with this exept with ssh but my main problem is why and how any info or help would really be appreciated
Make sure you're logged into the account that owns/has permissions to project1 by running:
heroku login
Also, you have a syntax error in your command, should be:
heroku addons:add sendgrid:starter --app project1

CLI isn't recognizing psql command

I've installed the Windows version of Postgres, as explained in the instructions here, and when I try to call heroku pg:psql, I get an error saying The local psql command could not be located. I've tried installing Postgres inside my app directory, but that hasn't worked.
Have you tried this suggested solutions?
The local psql command could not be located
The problem was a difference between the version of postgres on heroku compared to the local version. Try running heroku pg:info and compare it to postgres --version

Heroku won't reset my database

I have been trying to run $ heroku pg:reset from the command line but I believe I'm not putting in the database correctly. I've tried a number of variations.
I ran $ heroku config | grep POSTGRESQL to get the database name which prints as
HEROKU_POSTGRESQL_PINK_URL: postgres://naknaswvxfvuup:QK2dHYNMZ_va10lDgMDo4S0BIM#ec2-23-21-161-255.compute-1.amazonaws.com:5432/db7eute4gu4mcb
I've tried running everything from
#1
$ heroku pg:reset HEROKU_POSTGRESQL_PINK_URL: postgres://naknaswvxfvuup:QK2dHYNMZ_va10lDgMDo4S0BIM#ec2-23-21-161-255.compute-1.amazonaws.com:5432/db7eute4gu4mcb
#2
$ heroku pg reset postgres://naknaswvxfvuup:QK2dHYNMZ_va10lDgMDo4S0BIM#ec2-23-21-161-255.compute-1.amazonaws.com:5432/db7eute4gu4mcb
#3
$ heroku pg:reset db7eute4gu4mcb
and other variations. Please let me know how to correctly note this as I keep getting either an error or this text from the commmand line " ! Unknown database: db7eute4gu4mcb. Valid options are: DATABASE_URL, HEROKU_POSTGRESQL_PINK_URL"
I'm currently at 10.4 on the Ruby on Rails tutorial. Thanks!
You should specify a DATABASE when run heroku pg:reset. This is the syntax:
heroku pg:reset <DATABASE>
To know the value of , you can run:
heroku pg:info
It will return DATABASE_URL, something like: HEROKU_POSTGRESQL_GRAY_URL
Then you can reset your database:
heroku pg:reset HEROKU_POSTGRESQL_GRAY_URL
In your case, to reset database run:
heroku pg:reset HEROKU_POSTGRESQL_PINK_URL
this is how it worked for me
(replace app-staging with your app's name, do not replace DATABASE_URL, this is how heroku now finds the app's db)
heroku pg:reset DATABASE_URL --confirm app-staging
hope it helps
Assuming you have your authentication information exported to the shell environment, you should be fine with just passing the name of the database. For example:
PGPASSWORD='foobarbaz'
export PGPASSWORD
heroku pg:reset pink
There are certainly other ways to use the reset command, but IMHO this is the easiest.

"Resource not found" for Heroku PG commands

I got a free Heroku account and I'm working with:
Rails 3.2.8
Heroku heroku-toolbelt/2.33.2
PG
But, each time I'm typing a Heroku PG commands, I got this message:
Resource not found!
Except for the credentials command:
➜ heroku pg:credentials HEROKU_POSTGRESQL_MYDB
Connection info string:
"dbname=blahblahblah"
Else, all others command fail:
➜ heroku pg:info HEROKU_POSTGRESQL_MYDB
! Resource not found
➜ heroku pg:reset HEROKU_POSTGRESQL_MYDB
WARNING: Destructive Action
This command will affect the app: myapp
To proceed, type "myapp" or re-run this command with --confirm myapp
> myapp
Resetting HEROKU_POSTGRESQL_MYDB_URL (DATABASE_URL)... failed
! Resource not found
➜
Any ideas ?
If you need more information, tell me :)
Thanks!
Previously, there was some issue with heroku gem version(2.26.6) and this Resource not found occurred, but it gets fixed in the latest versions.
There is no problem with the current version what you are using.
Your heroku keys will be invalid(Trying to set up a heroku staging site - "Resource not found ").
If it is correct, you need to downgrade the heroku gem and check it.
Please follow this thread.
It will help you to fix the above issue.

Heroku rails error trying to bring up console - sh: rails: not found

Trying to run the Heroku console but I am getting this following:
heroku run console
Running console attached to terminal... up, run.1
sh: console: not found
$ heroku run bash works but I seem to get a (green) bash prompt - "~ $" not a rails console! Can I get into the console from here?
fyi
git push heroku v311
Everything up-to-date
The first error is thrown simply because the console command doesn't exist. I personally have never meet a command called console in my life.
The syntax is heroku run the_command_i_want_to_run. For example: heroku run irb or heroku run bash.
The second error: There's no Rakefile in your project root. Since heroku run rails console say that Rails wasn't found, my guess is that your project wasn't (well) deployed.
Make sure you've done git push heroku.
You may also need to check the logs: heroku logs.
a guess:
heroku run rails console
If you're on the Bamboo stack (older stack than Cedar), try:
heroku run script/rails console
This works for me and is the command recommended in Heroku docs.
I got confused by this too.
It's just
$ heroku run console
Do this
heroku run -a my-app script/rails console
Reference: https://devcenter.heroku.com/articles/console-bamboo

Resources