fix(auth): prevent ERR_SERVER_NOT_RUNNING on magic-link login; harden stopServer#474
Merged
facundo-herodevs merged 1 commit intomainfrom Feb 12, 2026
Merged
fix(auth): prevent ERR_SERVER_NOT_RUNNING on magic-link login; harden stopServer#474facundo-herodevs merged 1 commit intomainfrom
facundo-herodevs merged 1 commit intomainfrom
Conversation
sunshastry
approved these changes
Feb 11, 2026
KLongmuirHD
approved these changes
Feb 11, 2026
ce3be01 to
fcd30e6
Compare
fcd30e6 to
9c20e66
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes https://github.com/neverendingsupport/data-and-integrations/issues/549
Summary
This PR fixes a local CLI auth regression where
auth logincould throw:Error [ERR_SERVER_NOT_RUNNING]: Server is not running.even though authentication completed successfully (most visible in magic-link flows).
Root Cause
The OAuth callback server shutdown (
server.close) was not resilient to re-entrant/racing shutdown paths:When
close()was called on an already-closed server, Node returnedERR_SERVER_NOT_RUNNING.Because shutdown was not fully guarded, this surfaced as an exception during CLI login.
Changes
stopServerPromiseto deduplicate concurrent shutdown attempts.stopServer()to be idempotent:this.serverearlyERR_SERVER_NOT_RUNNINGas benign during cleanup.Failed to stop local OAuth callback server.) and moved detailed error info to debug logs.void this.stopServer()) where applicable.Why This Approach