Keep host and password when the legacy port argument is unset - #78
Open
freshlogic wants to merge 1 commit into
Open
freshlogic wants to merge 1 commit into
freshlogic wants to merge 1 commit into
Conversation
The constructor dispatched the legacy (port, host, options) signature on the port alone. Production callers pass process.env.redisPort, which is not set on any App Service, so undefined missed both the port branch and the options branch and fell through to createClient(undefined) -- discarding the host, the password and the offline-queue setting, and leaving an unauthenticated client pointed at localhost. Dispatch on arity as well, and let node-redis apply its own port default when the given one is unusable. The existing tests could not catch this because they all pass a literal port, and CI runs against a passwordless localhost Redis. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Coverage Report for CI Build 33523055812Warning No base build found for commit Coverage: 100.0%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
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.
The bug
v5.0.0's constructor dispatches the legacy(port, host, options)signature on the port argument alone. Every production caller passes:and
redisPortis not set on any App Service — verified in meh-com's app settings, which carryredisHostandredisPasswordand no port. SoundefinedfailsisPort(), fails thearguments[0] && typeof === 'object'check, and lands in the finalelseasredis.createClient(undefined).Measured against the branch head (
8d2f7b0) with the fleet's exact call shape:Host, password and the offline-queue setting all discarded, leaving an unauthenticated client pointed at localhost:6379. It does not throw. Every site would lose its cache at once on upgrade.
The existing tests cannot catch it — they all pass a literal port (
6379or'6379'), and CI runs against a passwordless localhost Redis where a misconfigured client still connects.The fix
Dispatch on arity as well as port type, and let node-redis apply its own port default when the given one is unusable, rather than discarding everything that follows it.
After:
Tests
One regression test covering the unset and empty-string port cases, asserting host and password survive. 176/176 pass, eslint clean.
🤖 Generated with Claude Code