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

redis.exceptions.ResponseError: unknown command 'module' #73

Closed
therealbazzi opened this issue Jan 6, 2022 · 12 comments · Fixed by #74
Closed

redis.exceptions.ResponseError: unknown command 'module' #73

therealbazzi opened this issue Jan 6, 2022 · 12 comments · Fixed by #74
Assignees

Comments

@therealbazzi
Copy link

therealbazzi commented Jan 6, 2022

Hi,

So basically trying to reproduce what @simonprickett did here except that i'm doing it on Redis cloud instead of locally or using a venv or docker or whatever.

So i've managed to successfully write to the redis db cloud after properly configuring REDIS_OM_URL to point at the proper endpoint x credentials, now when I perform a rediSearch query ex:
Adoptable.find(Adoptable.name == "Poppy").all()
I get the error
redis.exceptions.ResponseError: unknown command 'module'
Another way of reproducing the above is as follows:

from redis import ResponseError
try:
    Adoptable.find(Adoptable.name == "Poppy").all()
except ResponseError as e:
    print(e)

I've googled the above type of error but all i see is the same type of error but the word 'module' being swapped by different terms (ex: like JSON.GET whose solution was to include redisJSON)
Any help is appreciated, thank you.

PS: yes i have created my database by properly including modules rediSearch and redisJSON.

ahmad

@simonprickett simonprickett self-assigned this Jan 6, 2022
@simonprickett
Copy link
Contributor

@therealbazzi Hi there - I'm able to reproduce this, looks like the issue occurs because it's trying to call the MODULE LIST command in the Python library somewhere, and that's not available on Redis Enterprise. You can see this by trying to do the same thing in RedisInsight or redis-cli (see screenshot below). I'll dig into why it's doing this and see what we can do.

@therealbazzi
Copy link
Author

e to reproduce this, looks like the issue occurs because it's trying to call the MODULE LIST command in the Python library somewhere, and that's not available on Redis Enterprise. You can se

thanks @simonprickett - looks like you forgot to attach your screenshot ^^

@simonprickett
Copy link
Contributor

simonprickett commented Jan 6, 2022

Looks like the code here relies on MODULE LIST to determine which modules are installed in the Redis server... I don't think that's going to work on Enterprise.

Suggesting this be changed to determine if RediSearch and RedisJSON modules are installed using the COMMAND command e.g.:

COMMAND INFO FT.SEARCH
1) 1) "FT.SEARCH"
   2) -1
   3) 1) "readonly"
   4) 1
   5) 1
   6) 1
   7) (empty list or set)

and

COMMAND INFO JSON.SET
1) 1) "json.set"
   2) -1
   3) 1) "write"
      2) "denyoom"
   4) 1
   5) 1
   6) 1
   7) (empty list or set)

If the modules aren't installed, these commands will return a NIL response:

COMMAND INFO JSON.SET
1) (nil)

@therealbazzi I'll get a pull request together to make this change that should fix this on Redis Enterprise. Meantime I suggest you proceed with software development using Docker until this is released.

@simonprickett
Copy link
Contributor

e to reproduce this, looks like the issue occurs because it's trying to call the MODULE LIST command in the Python library somewhere, and that's not available on Redis Enterprise. You can se

thanks @simonprickett - looks like you forgot to attach your screenshot ^^

Oops so I did - here's what I mean :)
Screen Shot 2022-01-06 at 12 40 44 PM

@therealbazzi
Copy link
Author

therealbazzi commented Jan 6, 2022

Hi @simonprickett thanks a lot.
I went for the docker suggestion..
OK i got docker up and running w/ localhost and port 6379 ..
I could write to redis db (i see changes on redisInsight) all is good.
Problem is now when i want to query, ex:
Adoptable.find(Adoptable.name == "Poppy").all()
gives
redis_om.model.model.RedisModelError: Your Redis instance does not have either the RediSearch module or RedisJSON module installed. Querying requires that your Redis instance has one of these modules installed.
I know there's a config I messed up somewhere maybe .. hope you can help w/ this .. thank u

PS: I've also followed (hopefully) the same steps in your blog
Im assuming i have to include somewhere modules RedisJSON/RediSearch, but how to do that ?

@simonprickett
Copy link
Contributor

@therealbazzi to get going with the right modules installed you can use the Docker Compose file here that uses the redisearch container... when using the edge version of that you'll get both modules installed for you with no further config needed.

@therealbazzi
Copy link
Author

Docker Compose file here

I am using the docker compose that you link, but i still get the same issue.

@simonprickett
Copy link
Contributor

Docker Compose file here

I am using the docker compose that you link, but i still get the same issue.

Are you connecting to Redis at localhost:6379? Unset any REDIS_OM_URL environment variables to make sure. I just checked and my example from my repo works using that Docker Compose file.

@therealbazzi
Copy link
Author

therealbazzi commented Jan 6, 2022

REDIS_OM_URL

echo $REDIS_OM_URL
gives
redis://@127.0.0.1:6379
I have set this manually .. Also tried to unset on terminal as
unset REDIS_OM_URL still same error

PS: Yes docker is running on localhost:6379 and is writing properly on the redis db on RedisInsight (i see that).
PSS: I've changed to REDIS_OM_URL to
export REDIS_OM_URL=redis://@localhost:6379/
still doesn't work

@simonprickett
Copy link
Contributor

simonprickett commented Jan 6, 2022

REDIS_OM_URL

echo $REDIS_OM_URL gives redis://@127.0.0.1:6379 I have set this manually .. Also tried to unset on terminal as unset REDIS_OM_URL still same error

PS: Yes docker is running on localhost:6379 and is writing properly on the redis db on RedisInsight (i see that). PSS: I've changed to REDIS_OM_URL to export REDIS_OM_URL=redis://@localhost:6379/ still doesn't work

Can you share a project repo URL that I can look at and try and reproduce?

Also try stopping all the containers with docker ps then docker stop <id>, and restart using my Docker Compose. That will make sure the right container's on 6379.

@therealbazzi
Copy link
Author

Oh now it works. !! Thanks a lot @simonprickett .. I had to kill all ports running 6379 (had like 5 running for no reason or maybe because i did something previously on my laptop like redis-server start)

Thanks a lot man !

@simonprickett
Copy link
Contributor

simonprickett commented Jan 7, 2022

@therealbazzi this should be fixed in version 0.0.17 that I just released: https://pypi.org/project/redis-om/0.0.17/ [updated to say v 17 not 16]

simonprickett pushed a commit that referenced this issue Jan 7, 2022
…on-redis-enterprise

Changed the way that modules are detected to work with Redis Enterprise
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 a pull request may close this issue.

2 participants