redis / redis/node-redis

Need Migration Notices When v3 Code Detected

Open
#1,762 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
TypeScript
Stars
17.6k
Forks
2k
Avg merge
2d 3h
Merged PRs (30d)
40

Description

New user of node-redis, I was following the abundant documentation and examples across the 'net, including https://docs.redis.com/latest/rs/references/client_references/client_nodejs/ Unfortunately, nearly all documentation is for v3, which caused hours of lost time. Of particular note to me, the fact that clientConnect() no longer automatically connects made the code fail invisibly.

I finally found this repo, and realized that the problem was that I was using a very-new version of node-redis. I'm excited to explore this version in the future - at this time, it looks like an improvement on the previous design! (I'm especially excited to able to use await.)

However, we need clear messages which will warn users that they are using deprecated code. One simple example would be the host parameter, which can be passed to createClient(); if a user is passing that parameter, then it almost certainly means that they are using code that expects v3. An explicit error message would be very useful, and save your potential users hours of frustration. (It also lowers a barrier to entry for people just exploring the library, and thus prevents driving away potential future users.)

I know that many of the examples online (and thus, I presume many of your users) pass no parameters to createClient(), so the host parameter, while useful, is incomplete. Unfortunately, I'm too much of a newbie at this library to suggest where other warnings might be useful, but hopefully you can suggest some. Are there any commonly-used methods which are not sensible to call until the client has called connect()? That might be a good way to detect v3-expectant code.

Environment:

  • Node.js Version: v10.19.0
  • Node Redis Version: 4.0.0, reverted to 3.1.2
  • Platform: Ubuntu Docker Container

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the createClient() entry point and the connection-dependent methods discussed in the issue, comparing the v3 and v4 behavior described there. Identify which v3-style calls can be detected reliably and define the warning or error behavior; done means the migration notices cover the agreed common cases and are verified against the reported v3 usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.