Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"twilio-cli encountered an unexpected error." when logging in #122

Open
samuela opened this issue Sep 30, 2019 · 6 comments
Open

"twilio-cli encountered an unexpected error." when logging in #122

samuela opened this issue Sep 30, 2019 · 6 comments
Labels
difficulty: medium fix is medium in difficulty status: help wanted requesting help from the community triage queue Issue is in our internal backlog. It's either a bug or a feature enhancement. type: community enhancement feature request not on Twilio's roadmap type: docs update documentation change not affecting the code

Comments

@samuela
Copy link

samuela commented Sep 30, 2019

Issue Summary

twilio login fails when attempting to login. I'm running on Ubuntu 18.04 on AWS.

ubuntu@highcpu:~$ twilio login -l debug
[DEBUG] Config File: /home/ubuntu/.twilio-cli/config.json
? Shorthand identifier for your profile: highcpu
You can find your Account SID and Auth Token at https://www.twilio.com/console
 » Your Auth Token will be used once to create an API Key for future CLI access to your Twilio Project, and then forgotten.
? The Account SID for your Twilio Project: AC6608blahblahblah
? Your Twilio Auth Token for your Twilio Project: [hidden]
[DEBUG] -- BEGIN Twilio API Request --
[DEBUG] GET https://api.twilio.com/2010-04-01/Accounts/AC6608blahblahblah.json
[DEBUG] User-Agent: @twilio/cli-core/4.1.0 (twilio-node/3.35.0, node.js v12.10.0, linux 4.15.0-1050-aws x64, login)
[DEBUG] -- END Twilio API Request --
[DEBUG] response.statusCode: 200
[DEBUG] response.headers: {"date":"Mon, 30 Sep 2019 08:27:29 GMT","content-type":"application/json; charset=utf-8","content-length":"2261","connection":"close","last-modified":"Fri, 27 Sep 2019 20:11:55 +0000","twilio-concurrent-requests":"1","etag":"89c1bc3eb996c7dd6c4db5712d64c633","twilio-request-id":"RQ00dbced70bb44b0688ed3279223514e4","twilio-request-duration":"0.025","access-control-allow-origin":"*","access-control-allow-headers":"Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since","access-control-allow-methods":"GET, POST, DELETE, OPTIONS","access-control-expose-headers":"ETag","access-control-allow-credentials":"true","x-powered-by":"AT-5000","x-shenanigans":"none","x-home-region":"us1","x-api-domain":"api.twilio.com","strict-transport-security":"max-age=31536000"}
[DEBUG] -- BEGIN Twilio API Request --
[DEBUG] POST https://api.twilio.com/2010-04-01/Accounts/AC6608blahblahblah/Keys.json
[DEBUG] Form data:
[DEBUG] {"FriendlyName":"twilio-cli for ubuntu on highcpu"}
[DEBUG] User-Agent: @twilio/cli-core/4.1.0 (twilio-node/3.35.0, node.js v12.10.0, linux 4.15.0-1050-aws x64, login)
[DEBUG] -- END Twilio API Request --
[DEBUG] response.statusCode: 201
[DEBUG] response.headers: {"date":"Mon, 30 Sep 2019 08:27:30 GMT","content-type":"application/json; charset=utf-8","content-length":"246","connection":"close","twilio-concurrent-requests":"1","twilio-request-id":"RQ91996bfa46694fc6b9a7ca50dd83f903","twilio-request-duration":"0.031","access-control-allow-origin":"*","access-control-allow-headers":"Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since","access-control-allow-methods":"GET, POST, DELETE, OPTIONS","access-control-expose-headers":"ETag","access-control-allow-credentials":"true","x-powered-by":"AT-5000","x-shenanigans":"none","x-home-region":"us1","x-api-domain":"api.twilio.com","strict-transport-security":"max-age=31536000"}
[DEBUG] {"sid":"SKcd369339206b20f2fcaa18bed701413e","friendlyName":"twilio-cli for ubuntu on highcpu","dateCreated":"2019-09-30T08:27:30.000Z","dateUpdated":"2019-09-30T08:27:30.000Z","secret":"0jf7..."}
 » twilio-cli encountered an unexpected error. To report this issue, execute the command with the "-l debug" flag, then copy the output to a new issue here: https://github.com/twilio/twilio-cli/issues
[DEBUG] Cannot autolaunch D-Bus without X11 $DISPLAY
[DEBUG] Error: Cannot autolaunch D-Bus without X11 $DISPLAY

ubuntu@highcpu:~$ node --version
v12.10.0
ubuntu@highcpu:~$ npm --version
6.11.3
ubuntu@highcpu:~$ twilio --version
twilio-cli/1.6.0 linux-x64 node-v12.10.0

Steps to Reproduce

  1. Attempt login.
  2. Watch everything crash and burn.

Technical details:

  • twilio-cli Version: twilio-cli/1.6.0 linux-x64 node-v12.10.0
  • Node.js Version: v12.10.0
@childish-sambino childish-sambino added difficulty: medium fix is medium in difficulty status: help wanted requesting help from the community type: community enhancement feature request not on Twilio's roadmap type: docs update documentation change not affecting the code labels Sep 30, 2019
@childish-sambino
Copy link
Contributor

Looks like libsceret doesn't like headless systems. Think the best we can do is better document and wrap errors like this.

As a workaround for now, you can use env vars for auth as described here: https://www.twilio.com/docs/twilio-cli/general-usage#want-to-use-environment-variables-instead-of-creating-a-profile

@samuela
Copy link
Author

samuela commented Sep 30, 2019

Ah actually I encountered the same thing when implementing my own cli with keytar. I couldn't find anyway to use keytar headless at all. I ended up just coming up with a way to avoid logins on headless systems. Ultimately I think keytar is really just not that great for CLIs.

@childish-sambino
Copy link
Contributor

Yeah, definitely not for headless. We've made it an optional dependency and actually show a message about using env vars when it can't be found or fails to load.

But, it works well when there is a display on Macs, Win, and Linux. Just need better detection and docs.

@ereek
Copy link

ereek commented Sep 27, 2020

Ah actually I encountered the same thing when implementing my own cli with keytar. I couldn't find anyway to use keytar headless at all. I ended up just coming up with a way to avoid logins on headless systems. Ultimately I think keytar is really just not that great for CLIs.

@samuela Hi, Could you elaborate on how are you avoiding logins? I'm trying twilio-cli on WSL, and using env vars as a workaround for auth is not working on WSL at least, thank you.

@samuela
Copy link
Author

samuela commented Sep 27, 2020

@ereek This was so long ago that I forget what I did instead. Presumably using env vars as @childish-sambino pointed out should work?

@ereek
Copy link

ereek commented Sep 27, 2020

@samuela Thank you Samuel.

@shrutiburman shrutiburman added the triage queue Issue is in our internal backlog. It's either a bug or a feature enhancement. label Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: medium fix is medium in difficulty status: help wanted requesting help from the community triage queue Issue is in our internal backlog. It's either a bug or a feature enhancement. type: community enhancement feature request not on Twilio's roadmap type: docs update documentation change not affecting the code
Projects
None yet
Development

No branches or pull requests

4 participants