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

Handle null tuple for redisearch document #2856

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jjsimps
Copy link
Contributor

@jjsimps jjsimps commented Oct 18, 2024

Description

Recently, I updated to the latest version of RediSearch (2.10.7). I started getting a particular error that originates from within the redisearch library:

Cannot read properties of null (reading 'length') TypeError: Cannot read properties of null (reading 'length')
    at documentValue (/app/node_modules/.pnpm/@redis+search@1.2.0_@redis+client@1.6.0/node_modules/@redis/search/dist/commands/SEARCH.js:29:23)
    at Object.transformReply (/app/node_modules/.pnpm/@redis+search@1.2.0_@redis+client@1.6.0/node_modules/@redis/search/dist/commands/SEARCH.js:17:61)
    at transformCommandReply (/app/node_modules/.pnpm/@redis+client@1.6.0/node_modules/@redis/client/dist/lib/commander.js:89:20)
    at Commander.commandsExecutor (/app/node_modules/.pnpm/@redis+client@1.6.0/node_modules/@redis/client/dist/lib/client/index.js:190:54)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

This error seems to have originated from this change. Instead of returning an empty array [], None is returned. The library does not handle this case, and so the error is thrown.

This PR checks if the document is NULL, and if it is, return the object. This would give the same behavior as before.

I encountered this in the latest redis version (4.7). Not sure which branch I should be comitting to.


Checklist

  • Does npm test pass with this change (including linting)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

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

Successfully merging this pull request may close these issues.

1 participant