Heroku login cannot open browser

Tom Granot picture Tom Granot · Jul 18, 2019 · Viewed 7.2k times · Source

When attampting to login to Heroku via the CLI, I get:

user@MyMachine:$ sudo heroku login 
heroku: Press any key to open up the browser to login or q to exit: 
Opening browser to https://cli-auth.heroku.com/auth/browser/SOME-HEROKU-TOKEN
Warning: Cannot open browser.
heroku: Waiting for login... !

And the login hangs while waiting for the browser. When I open the link in the browser and try to login, nothing happens in the CLI.

Using the debugging flags yields:

user@MyMachine:~$ sudo HEROKU_DEBUG=true HEROKU_DEBUG_HEADERS=1 heroku login 
heroku: Press any key to open up the browser to login or q to exit: 
Opening browser to https://cli-auth.heroku.com/auth/browser/SOME-OTHER-TOKEN
Warning: Cannot open browser.
    at Object.warn (/snap/heroku/3776/node_modules/@oclif/errors/lib/index.js:33:15)
    at showUrl (/snap/heroku/3776/node_modules/@heroku-cli/command/lib/login.js:132:34)
    at ChildProcess.cp.on.code (/snap/heroku/3776/node_modules/@heroku-cli/command/lib/login.js:145:17)
    at ChildProcess.emit (events.js:193:13)
    at maybeClose (internal/child_process.js:999:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
heroku: Waiting for login... !
JSONError: Unexpected end of JSON input while parsing near ' '
    at module.exports (/snap/heroku/3776/node_modules/parse-json/index.js:26:19)
    at HTTP._parse (/snap/heroku/3776/node_modules/@heroku-cli/command/node_modules/http-call/lib/http.js:343:25)

And again, a hang.

Answer

dickenzoh picture dickenzoh · Sep 29, 2019

Heroku is currently under update but try this should work: heroku login -i