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

Node Redis cannot return empty documents #2364

Closed
guyroyse opened this issue Jan 4, 2023 · 0 comments · Fixed by #2366
Closed

Node Redis cannot return empty documents #2364

guyroyse opened this issue Jan 4, 2023 · 0 comments · Fixed by #2366
Labels

Comments

@guyroyse
Copy link
Contributor

guyroyse commented Jan 4, 2023

When executing the following code:

const results = await nodeRedis.ft.search('test:index', '*', { RETURN: [] })

I get the following error:

/Users/guyroyse/code/playground/ioredis-tests/node_modules/@redis/search/dist/commands/SEARCH.js:18
            value: tuples.length === 2 && tuples[0] === '$' ?
                          ^

TypeError: Cannot read properties of undefined (reading 'length')
    at Object.transformReply (/Users/guyroyse/code/playground/ioredis-tests/node_modules/@redis/search/dist/commands/SEARCH.js:18:27)
    at transformCommandReply (/Users/guyroyse/code/playground/ioredis-tests/node_modules/@redis/client/dist/lib/commander.js:88:20)
    at Commander.commandsExecutor (/Users/guyroyse/code/playground/ioredis-tests/node_modules/@redis/client/dist/lib/client/index.js:177:54)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async rediSearchResult (file:///Users/guyroyse/code/playground/ioredis-tests/server.js:66:19)
    at async file:///Users/guyroyse/code/playground/ioredis-tests/server.js:71:1

It looks like Node Redis doesn't handle an empty RETURN.

Environment:

  • Node.js Version: 16.16.0
  • Redis Server Version: 6.2.7
  • Node Redis Version: 4.5.1
  • Platform: Mac OS 12.6
@guyroyse guyroyse added the Bug label Jan 4, 2023
leibale added a commit to leibale/node-redis that referenced this issue Jan 4, 2023
leibale added a commit that referenced this issue Jan 18, 2023
* fix #2364 - fix FT.SEARCH RETURN []

* remove console.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant