cli: "SyntaxError: Unexpected end of JSON input" if browser login flow not completed
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
- Install the CLI via Homebrew on OS X 10.14.3.
- Run
heroku autocompleteas suggested by the post-install console output. - Press spacebar at the “press any key to open the browser” prompt.
- Close the newly opened browser tab, since not wanting to log in right now.
- When CLI times out, the following is output:
Building the autocomplete cache... ?
Opening browser to https://cli-auth.heroku.com/auth/browser/REDACTED
heroku: Waiting for login... !
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at HTTP._parse (/usr/local/Cellar/heroku/7.22.7/libexec/node_modules/http-call/lib/http.js:342:30)
What is the expected behavior?
- The
autocompletecommand does not trigger the login flow. - The CLI gracefully handles the user not completing the browser login flow. ie: After N seconds of waiting for the auth callback, the CLI exits with an appropriate message (eg “Timed out waiting for browser sign in”) and no stack trace.
This was using: heroku/7.22.7 darwin-x64 node-v11.10.1
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 9
- Comments: 23
Hey guys, in case you are having this issue using any CLI command (for instance
heroku apps)What worked for me was:
config.jsonfile. (In my case it didn’t have any content)In my case I’m on a Mac, the path for the file is:
your-user-folder/.local/share/heroku/config.jsonI was able to solve the login issue using
heroku login --interactiveUbuntu 20, In my case, I just removed the file and it is recreated on login.
Any solutions? Same problem from using Cloud9:
thanks bro
@sammymwangangi Thanks it’s work for me
worked for me too, thanks sammy
i can not thank you enough sammymwanga~it’s worked.
Thank you Sammy…
This Worked for me too! Thanks a lot!
you did it, thanks a lot
I can’t thank you enough sammymwanga! it’s worked:)
Thanks alot sammymwanga ! it’s worked for me !
Reinstalling heroku cli solved the problem for me…