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
Improve interactive AWS creds flow #6449
Conversation
closes PLAT-1341 implemented by asking if the user has an account, if not, open browser to sign up and then open browser (in new or existing acct case) to create an admin user for user with serverless. added open as a dependency to open the browser
Uggh... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uggh... open>=6 depends on node >= 8 but open<6 fails npm audit. Any ideas?
I looked for alternatives, but apparently there are no up-to-date packages out there.
🤔 Maybe we can to fork open
it and fix the dependency issue for version 6 on our own?
console.log('---------------------------'); | ||
const errMsg = err ? `\nError: ${err.message}` : ''; | ||
const msg = `Unable to open browser automatically${errMsg}`; | ||
console.log(`🙈 ${chalk.red(msg)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While cute I'm unsure if we want to go the "emotification of all the CLIs" route in an enterprise-facing project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copy and pasted this out of platform-sdk
😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(as to why i copied, it.. didn't want to add sdk as a direct dep, which is the only way to guarantee it's availability with things like yarn
, and now also the fact it requires newer versions of node)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now also the fact it requires newer versions of node
But SDK Is dependency of a plugin.. so if SDK was updated to not work in v6, then through Plugin it'll also break SLS (?)
Yeah.. It's a single file AFAICT https://github.com/sindresorhus/open/blob/master/index.js So i'll do that. |
7c9ae42
to
9c816f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good.
The only issue I ran into was that the focus was switched to my browser when I answered the question "Serverless: Do you want to set them up now? Yes". The problem is that there was no website opened. Only the browser was focused. The steps after that opened the browser URLs correctly.
Here are the logs:
[~/Desktop/code.nosync/serverless/tmp]$ ../bin/serverless
Serverless: No project detected. Do you want to create a new one? Yes
Serverless: What do you want to make? AWS Node.js
Serverless: What do you want to call this project? foo
Project successfully created in 'foo' folder.
No AWS credentials were found on your computer, you need these to host your application.
Serverless: Do you want to set them up now? Yes
Serverless: Do you have an AWS account? No
Serverless: Press Enter to continue after creating an AWS account
Serverless: Press Enter to continue after creating an AWS user with access keys
Serverless: AWS Access Key Id:
Safari is my primary browser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is such a slick experience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested this again to see if it's a glitch but I can consistently reproduce the problem that the default Broswer (Safari in my case) is opened without opening a new tab / window (see comment above).
@medikoo can you take this for a spin and see if you're also facing the same problems? I'm wondering if it's just Safari which has problems here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like really good improvement. Just minor remarks.
|
||
function displayManualOpenMessage(url, err) { | ||
// https://github.com/sindresorhus/log-symbols | ||
console.log('---------------------------'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we do not rely here on serverless logger? Even if we don't like to use cli.log
we may rel on cli.consoleLog
.
It'll clearly indicate the intention of generating user facing CLI output.
Direct use of console.log
is more for temporary debug output (which we prevent from committing in via lint rules)
console.log('---------------------------'); | ||
const errMsg = err ? `\nError: ${err.message}` : ''; | ||
const msg = `Unable to open browser automatically${errMsg}`; | ||
console.log(`🙈 ${chalk.red(msg)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now also the fact it requires newer versions of node
But SDK Is dependency of a plugin.. so if SDK was updated to not work in v6, then through Plugin it'll also break SLS (?)
What did you implement:
closes PLAT-1341
How did you implement it:
implemented by asking if the user has an account, if not, open browser to sign up
and then open browser (in new or existing acct case) to create an admin user for
user with serverless.
added open as a dependency to open the browser
How can we verify it:
Todos:
Note: Run
npm run test-ci
to run all validation checks on proposed changesValidate via
npm test
Validate via
npm run lint-updated
Note: Some reported issues can be automatically fixed by running
npm run lint:fix
Validate via
npm run prettier-check-updated
Note: All reported issues can be automatically fixed by running
npm run prettify-updated
Is this ready for review?: NO
Is it a breaking change?: NO