-
Notifications
You must be signed in to change notification settings - Fork 63
Streamlining the credentials confusion #163
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
Comments
@philnash let me know what you think when you have some time |
Option 1 sounds right to me, when you use the CLI you expect it to work the same across plugins, and that includes using your default profile credentials. Note: |
Wanted to add a highly related issue that I was experiencing yesterday. I wasn't using Wanting to run this from a local dev server, I added the three variables to I think I prefer option 1 of the two that you propose. +1 about using the default profile credentials when they are available. It feels wrong to me, generally speaking, to have the To elaborate on this a little bit more, there might be something to learn from the gcloud CLI -- you can switch between profiles using a shell environment variable. Direnv makes this very easy to accomplish. Currently with the twilio CLI, you'd have to use the direnv hook to call I think it's probably fine for a Also not that you should care what I think 😉, but I prefer API Key/API Secret to username/password. I think it's better to try to teach people that their ACCOUNT_SID and AUTH_TOKEN can also be used as an API Key and Secret than it is to teach people that username/password DON'T mean the username and password that they already have for Twilio itself, but instead mean either one of two different types of credential with different names. |
Thank you @NReilingh for your feedback. We always love getting feedback from customers and the community and I'm sorry you hit this roadblock. The behavior should definitely be fixed with Option 1. I think improving the way the configuration works (#166) should help with that as well. In terms of CI and pulling in variables from your system, we recently fixed that in #144 where you can use the That in combination with #166 should enable you to define a config such as:
That will enable you to use |
Also as per your last point: I generally agree on educating people that API Key and Secret can work like Account SID and Auth Token. I think for the command line arguments we will transition to |
As part of Option 1, we should enhance the |
As described in #163, never use .env variables to set account sid and auth token when called from the Twilio CLI. BREAKING CHANGE: deploys may not work as previously
As described in #163, never use .env variables to set account sid and auth token when called from the Twilio CLI. BREAKING CHANGE: deploys may not work as previously
As described in #163, never use .env variables to set account sid and auth token when called from the Twilio CLI. BREAKING CHANGE: deploys may not work as previously
Fixed in #224 |
Background
Twilio Functions provides you in the deployed environment access to
ACCOUNT_SID
andAUTH_TOKEN
both as part of thecontext
as well as exposed inprocess.env
. Whentwilio-run
was initially created for local development we opted to mirror this as best as possible. Whencreate-twilio-function
came along we stuck with the same system.However, when Twilio CLI was created they explicitly went with API Key and API Secret instead of Account SID and Auth Token. Since the Serverless API doesn't really care about which of these two pairs it gets, we did a "quick fix" of setting the API Key and API Secret as Account SID and Auth Token respectively.
The Issues
This "quick fix" results in you being able to run
npm run deploy
without a problem, however, causes several problems.ACCOUNT_SID
inside their.env
file and are surprised when it's aAPI_KEY
.context.getTwilioClient()
. In order to mirror the behavior of Twilio FunctionsgetTwilioClient()
uses the values fromACCOUNT_SID
andAUTH_TOKEN
but also requires that those are actually Account SID and Auth Token. If that's not the case the user gets an error and has to manually change those.Potential Solutions
There's two solutions to this dilemma. Regardless of the two cases the following should be a given:
accountSid
andauthToken
as config options from@twilio-labs/serverless-api
in favor ofusername
andpassword
.Both options will require a major version bump.
Option 1
create-twilio-function
we will continue to ask for Account SID and Auth Token and will populate those in the.env
file for the usertwilio serverless:init
we will only populateACCOUNT_SID
in the.env
filetwilio-run deploy
we will use the credentials from the.env
file unless something else is specified via CLI argumentstwilio serverless:deploy
we will use the credentials stored in the Twilio CLI, disregarding the values in.env
[BREAKING CHANGE] this is a breaking change because currently even this command would prefer the.env
values unless a profile is explicitly passed viatwilio serverless:deploy -p default
Aside of that last change there shouldn't be much of an impact for users in this case. They will still have to add the Auth Token manually though unless getting it magically to work if they want to use
context.getTwilioClient()
but at least the error will be more useful.Option 2
create-twilio-function
we will continue to ask for Account SID and Auth Token and will populate those in the.env
file for the usertwilio serverless:init
we will populateACCOUNT_SID
as well as create aTWILIO_API_USERNAME
andTWILIO_API_PASSWORD
variables in the.env
file.env
file.TWILIO_API_USERNAME
andTWILIO_API_PASSWORD
from being uploaded when uploading other.env
variables.The text was updated successfully, but these errors were encountered: