certificate has expired error whilst running heroku commands - heroku

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.

Related

Heroku ps:exec won't connect

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.

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

Docker and Namespace-related errors after a successful login to Bluemix

I have installed Python (with Pip and easysetup), Cloud Foundry and ICE in my host machine, OS X 10.10.3.
I've booted boot2docker and attempted to ice login.
After a successful login attempt:
mbp-idan:~ idanadar$ boot2docker up
Waiting for VM and Docker daemon to start...
.o
Started.
Writing /Users/idanadar/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/idanadar/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/idanadar/.boot2docker/certs/boot2docker-vm/key.pem
Your environment variables are already set correctly.
mbp-idan:~ idanadar$ ice login
API endpoint: https://api.ng.bluemix.net
Email> my-email-address
Password> my-password
Authenticating...
OK
Targeted org my-email-address
Targeted space dev
API endpoint: https://api.ng.bluemix.net (API version: 2.23.0)
User: my-email-address
Org: my-email-address
Space: dev
Authentication with container cloud service at https://api-ice.ng.bluemix.net/v2/containers completed successfully
You can issue commands now to the container service
I immediately encounter the following errors:
Authentication issue:
Proceeding to authenticate with the container cloud registry at registry-ice.ng.bluemix.net
FATA[0005] Error response from daemon: Login: You must set a namespace before you login to the registry. See 'ice help namespace' (Code: 404; Headers: map[Connection:[Keep-Alive] Date:[Wed, 27 May 2015 18:57:41 GMT] Content-Type:[text/plain] X-Client-Ip:[79.176.226.146] X-Backside-Transport:[FAIL FAIL] Server:[nginx/1.7.9] X-Global-Transaction-Id:[380677271] Set-Cookie:[DPJSESSIONID=PBC5YS:481842763; Path=/; Domain=.registry-ice.ng.bluemix.net]])
Docker issue:
docker is not available on your system or is not properly configured
Could not authenticate with cloud registry at registry-ice.ng.bluemix.net
You can still use IBM Containers but will not be able to run local docker containers, push, or pull images
The only configuration I did previously was adding the following to ~/.bash_profile, which is what provided by Docker when using boot2docker up:
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/idanadar/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
Once I did this change, I get the above two errors. If I will comment out the above three lines from .bash_profile, and not run boot2docker shellinit after boot2docker up, I will get this error:
FATA[0000] Post http:///var/run/docker.sock/v1.18/auth: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
docker is not available on your system or is not properly configured
Could not authenticate with cloud registry at registry-ice.ng.bluemix.net
You can still use IBM Containers but will not be able to run local docker containers, push, or pull images
If I will replace the three lines with this single line:
export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375
I will get the following error, which is a bit different. Note the -d and lack of error regarding namespace.
Proceeding to authenticate with the container cloud registry at registry-ice.ng.bluemix.net
FATA[0000] Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
docker is not available on your system or is not properly configured
Could not authenticate with cloud registry at registry-ice.ng.bluemix.net
You can still use IBM Containers but will not be able to run local docker containers, push, or pull images
[docker] Any idea which is the right way to get Docker recognized?
This is being tested in OS X 10.10.3.
[bluemix] Any idea about the namespace?
For some reason they seem inter-linked?
The error that is outputted by ICE is really unhelpful.
To solve it:
Added back to ~/.bash_profile the original 3 lines
Created the namespace in Bluemix.net
After that, everything has fallen to place and everything is working.

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?

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