$ heroku whoami?

(Everyday Code – instead of keeping our knowledge in a README.md let’s share it with the internet)

Today many things stopped in our dev procedures and I had to learn about heroku auth:whoami and to use it. Luckily, nothing about production, but a few engineers were puzzled as to why certain dev services are not working.

Heroku CLI logged itself out

We are using Heroku CLI a lot for a lot of different things. One example is backups. We backup the Heroku DBs regularly – like Daily, Weekly, Monthly and some of the backups stopped working. A few other services also stopped working. The problem was with Heroku CLI. The direct log from our Jenkins was:

heroku: Press any key to open up the browser to login or q to exit:  ▸    Invalid credentials provided.
Enter your Heroku credentials:

Strange. It was working for years and now suddenly heroku cli decides to log itself out and it then requires us to log in. How come, we don’t know. I’ve created a Ticket with Heroku. My greatest concern is that it could be a security issue with someone gaining access to a dev machine and logging out, but I have no evidence of this.

$ heroku auth:whoami

I had to log in again with heroku. But I also wanted the builds that were ran with Jenkins to fail if heroku cli is not logged in. I found the command:

$ heroku auth:whoami

Which does the job. If we are not logged in the command will return and the bash script will fail.

We are happy again

This instruction is delivered with heroku 🙂

FabBRIX Pets, Hamster in 3D building instructions