-
Notifications
You must be signed in to change notification settings - Fork 803
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
stop login console spam #695
Conversation
🦋 Changeset detectedLatest commit: 7aa4794 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/2059265420/npm-package-wrangler-695 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/695/npm-package-wrangler-695 Or you can use npx https://prerelease-registry.developers.workers.dev/runs/2059265420/npm-package-wrangler-695 dev path/to/script.js |
Partially this involves mocking `open-in-browser.ts`, which I've chosen to mock out in `user.test.ts` rather than `jest.setup.ts` since we might later want to mock it out differently for testing wrangler dev
3f94ed2
to
63b5148
Compare
And just disable it for login checks
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.
NICE work @caass
@@ -963,6 +979,8 @@ export async function login(props?: LoginProps): Promise<boolean> { | |||
server.listen(8976); | |||
}); | |||
|
|||
await openInBrowser(urlToOpen); |
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.
NOTE: moving this here, helps to ensure that the HTTP server that will receive the callback from the OAuth provider is already listening before we try to open the OAuth web page.
Such a good PR. |
If a user hasn't logged in and then they run a command that needs a login they'll get bounced to the login flow.
The login flow (if completed) would write their shiny new OAuth2 credentials to disk, but wouldn't reload the
in-memory state. This led to issues like #693, where even though the user was logged in on-disk, wrangler
wouldn't be aware of it.
We now update the in-memory login state each time new credentials are written to disk.