Ioredis: Cannot parse the db number correctly

Created on 25 Sep 2019  路  5Comments  路  Source: luin/ioredis

I am getting this error:

{ ReplyError: ERR DB index is out of range
    at parseError (/root/interos/repos/ntrs-cli/node_modules/redis-parser/lib/parser.js:179:12)
    at parseType (/root/interos/repos/ntrs-cli/node_modules/redis-parser/lib/parser.js:302:14) command: { name: 'select', args: [ '20127' ] } }

here is what I have:

const client_db0 = new Redis(`redis://${conf["platform-build.public-dns"]}:6379/0`);
const client_db1 = new Redis(`redis://${conf["platform-build.public-dns"]}:6379/1`);
const client_db2 = new Redis(`redis://${conf["platform-build.public-dns"]}:6379/2`);
const client_db3 = new Redis(`redis://${conf["platform-build.public-dns"]}:6379/3`);
wontfix

All 5 comments

it is due to the extra whitespace here:

 'platform-build.public-dns': ' 127.0.0.1',

that sucks

that error is quite misleading

I assume the error: command: { name: 'select', args: [ '20127' ] } is somehow intepreting

'redis:// 127.0.0.1:6379:1'   # note single whitespace char after //

as db number 20127 somehow? weird parsing

because space is encode to %20 so it becomes redis://%20127.0.0.1:6379/1

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 7 days if no further activity occurs, but feel free to re-open a closed issue if needed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saschaishikawa picture saschaishikawa  路  4Comments

eduleboss picture eduleboss  路  3Comments

pavanratnakar picture pavanratnakar  路  4Comments

jehy picture jehy  路  4Comments

jamesdixon picture jamesdixon  路  4Comments