Skip to content
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

Invalid db option causes ReplyError: ERR invalid DB index #1213

Open
paxcol opened this issue Oct 21, 2020 · 0 comments
Open

Invalid db option causes ReplyError: ERR invalid DB index #1213

paxcol opened this issue Oct 21, 2020 · 0 comments

Comments

@paxcol
Copy link

paxcol commented Oct 21, 2020

How to reproduce

Pass db option as a string when creating Redis object:

const Redis = require("ioredis");
const redis = new Redis({db: 'some-string'})

It will throw an uncaught error:

(node:2467) UnhandledPromiseRejectionWarning: ReplyError: ERR invalid DB index
    at parseError (node_modules/redis-parser/lib/parser.js:179:12)
    at parseType (node_modules/redis-parser/lib/parser.js:302:14)

(node:2467) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:2467) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

What causes this

All select commands have no callback or error handling in ioredis.

What I expect

This error is caught by ioredis either through a rejected promise fromRedis.connect() or the error event listener but not an unhandledPromiseRejection.

Linked issues

  1. ReplyError: ERR invalid DB index #1113
  2. ReplyError: ERR invalid DB index  #74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant