Heroku ps:exec won't connect - heroku

I'm quite a newbie on heroku. So, sorry for the silly question.
My problem is, I don't know what is the error, but one thing for sure I couldn't connect through ssh to my heroku server. If possible I would like to know how to get more detailed error log or something like that. I've tried adding -v or --verbose switch to heroku command but no luck.
Bellow is the complete action I did, well, Basically I followed what is written in the heroku's site.
Here's how to connect through ssh according to heroku's tutorial site.
xxx#yyy:~/xwprog/heroku-sample-gradle1
$ heroku ps:exec
Establishing credentials... done
Connecting to web.1 on ⬢ guarded-fjord-42322...
▸ There was an error connecting to the dyno!
process currently running
xxx#yyy:~/xwprog/heroku-sample-gradle1
$ heroku ps
Free dyno hours quota remaining this month: 550h 0m (100%)
For more information on dyno sleeping and how to upgrade, see:
https://devcenter.heroku.com/articles/dyno-sleeping
=== web (Free): build/install/gradle-getting-started/bin/gradle-getting-started (1)
web.1: up 2018/03/10 16:56:04 +0700 (~ 16m ago)
Tried to run bash, but it's actually work. The downside was each time I disconnected from it, the state also got reset, and prone to get disconnected, with error message ECONNRESET: read ECONNRESET
xxx#yyy:~/xwprog/heroku-sample-gradle1
$ heroku run bash
Running bash on ⬢ guarded-fjord-42322... up, run.3587 (Free)
~ $
Thank you.

Related

certificate has expired error whilst running heroku commands

I'm trying to do the following with my hosted app on Heroku-
create a database backup
download the database backup
Restore the backup in a local postgres database
However, I get stuck in the first step itself. Running the below command throws the following error -
heroku pg:backups:capture -a app-name
CERT_HAS_EXPIRED: certificate has expired
I even tried running the following command, however, that did not help either -
heroku run:detached pg:backups capture –a app-name
Running pg:backups:capture on ⬢ app-name... done, run.1879 (Free)
Run heroku logs --app app-name --dyno run.1879 to view the output.
(env) E:\new_website\>heroku logs --app app-name --dyno run.1879
2021-10-29T05:18:36.001962+00:00 heroku[run.1879]: Starting process with command pg:backups:capture
2021-10-29T05:18:36.564987+00:00 heroku[run.1879]: State changed from starting to up
2021-10-29T05:18:36.953570+00:00 app[run.1879]: bash: pg:backups:capture: command not found
2021-10-29T05:18:37.068925+00:00 heroku[run.1879]: Process exited with status 127
2021-10-29T05:18:37.103435+00:00 heroku[run.1879]: State changed from up to complete
Finally, I also tried using the HEROKU_DEBUG environment variable to see what the real error was -
(env) E:\new_website\>SET HEROKU_DEBUG=1
(env) E:\new_website\>heroku pg:backups:capture --app app-name
Adding the following trusted certificate authorities
E:\ap01\Ruby\cacert.pem
--> POST /actions/addon-attachments/resolve
--> {"app":"neevista-web","addon_attachment":"DATABASE_URL","addon_service":"heroku-postgresql"}
<-- 200 OK
<-- [{"addon":{"id":"9ccc7a6d-8001-473a-8ef1-e24614ad26c0","name":"postgresql-curly-92807","app":{"id":"587ec79f-3989-40eb-bceb-17220824a275","name":"app-name"},"plan":{"id":"062a1cc7-f79f-404c-9f91-135f70175577","name":"heroku-postgresql:hobby-dev"}},"app":{"id":"587ec79f-3989-40eb-bceb-17220824a275","name":"app-name"},"id":"5a2ba589-22e6-4c42-a3bd-d634b4581eb5","name":"DATABASE","namespace":null,"created_at":"2021-06-21T15:05:48Z","updated_at":"2021-06-21T15:05:48Z","web_url":"https://addons-sso.heroku.com/apps/587ec79f-3989-40eb-bceb-17220824a275/addons/9ccc7a6d-8001-473a-8ef1-e24614ad26c0","log_input_url":null,"config_vars":["DATABASE_URL"]}]
Adding the following trusted certificate authorities
E:\ap01\Ruby\cacert.pem
--> GET /client/v11/databases/9ccc7a6d-8001-473a-8ef1-e24614ad26c0
! CERT_HAS_EXPIRED: certificate has expired
Error: certificate has expired
at TLSSocket.onConnectSecure (_tls_wrap.js:1502:34)
at TLSSocket.emit (events.js:314:20)
at TLSSocket._finishInit (_tls_wrap.js:937:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:711:12)
I've tried updating Heroku CLI, restarting the Heroku app but nothing has helped. Not sure if this helps but I've two versions (9 and 13) of Postgresql running on this windows machine and my app is trying the use the version 13.
Could you please advise what I'm doing wrong here or if there is an ongoing issue at your end?
I finally figured it out myself after Heroku support failed to assist as they classified the issue as a local problem.
For some reason, I'd setup SSL_CERT_FILE environment variable previously. This environment variable was pointing to a certificate pem file -> E:\ap01\Ruby\cacert.pem
After deleting this environment variable heroku commands started to work again.

Heroku DB deployment

I'm attempting my first Heroku deployment and am having trouble
heroku pg:backups:restore "https://s3.us-east-2.amazonaws.com/myusername/POSTGRESQL.dump"
DATABASE_URL --app MyAppName
I receive the error
! An error occurred and the backup did not finish.
!
! pg_restore: [archiver] did not find magic string in file header
! 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 r006 for more details.
And sometimes the error is:
Starting restore of https://s3.us-east-2.amazonaws.com/talXXXXXXXX to postgresql-XXXXXXXXX... done
Use Ctrl-C at any time to stop monitoring progress; the ba
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 publicl
!
! Run heroku pg:backups:info r015 for more details.
I have confirmed from various browsers that the url is accessible to the public and I can download the file. I'm using double quotes around the URL as recommended for Windows, what am I doing wrong?
I was facing the same problem. Turn out it was a problem with my dump file. I wasn't compressing it properly.
--format=c selects custom as the format output (which is the same as -Fc). It compress the file by default, but it wasn't enough so I also used the --compress flag.
This flag tells the level of the compression; it goes from 0 (lighter) to 9 (heavier).
I used 9, just in case, and my command end up like that
pg_dump --format=c --compress=9 --no-acl --no-owner -h THE_HOST -U YOUR_USER THE_DATABASE > YOUR_FILE.dump
And it worked.
In the end I couldn't work out how to import to Heroku as they advertise it can be done at https://devcenter.heroku.com/articles/heroku-postgres-import-export#import
So I used a DB connection client like DBeaver, converted my DB dump into an SQL script and ran the script manually to import the data.
:(
I was able to get this working by creating the backup through PgAdmin4, rather than through the console dump command on Heroku's official tutorial.
I also could only get this working through PgAdmin, here's the command line that the backup job in PgAdmin used. Windows 10 but the pg_dump options should work on any OS.
C:\Program Files\PostgreSQL\13\bin\pg_dump.exe --file "mydump.dump" --host "localhost" --port "5432" --username "postgres" --no-password --verbose --format=c --blobs --compress "8" --no-owner --section=pre-data --section=data --section=post-data --no-privileges --no-tablespaces --no-unlogged-table-data --no-comments "mydatabase"
I then uploaded that to a public Azure blob file and restored it like this:
heroku pg:backups:restore "https://redacted.blob.core.windows.net/piis2/mydump.dump" DATABASE_URL

heroku run returns "no route to host" error

I have a django project that is running on heroku. I am able to run certain heroku commands, such as heroku ps and heroku logs. When I try to use any heroku run commands, I get a no route to host error.
heroku run ls
Running ls attached to terminal... /usr/local/heroku/lib/heroku/client/rendezvous.rb:33:in `initialize': No route to host - connect(2) (Errno::EHOSTUNREACH
I am using chrome on a home wireless dsl connection, with no firewalls or anything on my end.
What can I do to use heroku run?

Running Heroku Console does not start

I am trying to run Heroku console, but in the console, I get the message "Running console attached to terminal" but the console doesn't start.
In the Heroku logs, I get the error:
Error: no child processes attached.
Any help?
I just had a thread with Heroku support about my similar issue, here was their response, which worked for me.
So this is a bamboo app. You can either do
$ heroku console
which will tap into a running web dyno, or you can run a new console
as a one-off process with:
$ heroku run bundle exec rails console
On cedar apps you'd also be able to do
$ heroku run console
which also starts a one-off process, because the console process type
would be implied by the rails buildpack or declared in your Procfile.
It amounts to the same as the previous line.
I was experiencing same issues.
Try
heroku run rails console
in Rails >=3
Happy coding :)
Try
$ telnet rendezvous.heroku.com 5000
to test the net enabled access to that port. They mention that filtered-port issue on their guide
I think this is the same problem you're describing and it has an accepted answer which seemed to fix the issue for the guy that posted the question :-)
heroku run console returns 'Error connecting to process'
I had this problem before I'd actually pushed my code to heroku.
Once I successfully pushed and started everything (bundle, rake etc.) the console actually worked.
Do this and then try
In Procfile
web: bundle exec unicorn_rails -p $PORT -c config/unicorn.rb
In unicorn.rb
worker_processes 2
preload_app true
timeout 30
#resque_pid = nil
before_fork do |server, worker|
#resque_pid ||= spawn("bundle exec rake environment resque:work QUEUE=*")
end
after_fork do |server, worker|
ActiveRecord::Base.establish_connection
end

unknown heroku error

i am experiencing following error while trying to run application on heroku
2011-06-03T11:24:25-07:00 heroku[nginx]: GET / HTTP/1.1
2011-06-03T18:24:37+00:00 heroku[router]: Error H14 (No web processes runnig)
that's the only message i am getting, and it's not even mentioned in heroku error codes at http://devcenter.heroku.com/articles/error-codes
what could be the reason of this?
heroku restart
made it work properly again
As given on http://devcenter.heroku.com/articles/error-codes
H14 - No web processes running
This is most likely the result of scaling your web processes down to zero through the client.
$ heroku scale web=0
Use the heroku ps command to determine the state of your web processes.
If problems persists after heroku restart;
Destroy the heroku app and re-create.
Heroku restart
didn't fix the issue. I added a new line in my Gemfile (just a new line, no text) to force heroku to reinstall gems and this fixed the issue.

Resources