0

I am trying to store some session data in Redis JSON, but I am running into the following error:

Traceback (most recent call last):
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\redis\connection.py", line 559, in connect     
    sock = self._connect()
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\redis\connection.py", line 584, in _connect    
    for res in socket.getaddrinfo(self.host, self.port, self.socket_type,
  File "C:\Users\ndung\AppData\Local\Programs\Python\Python310\lib\socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 407, 
in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, 
in __call__
    return await self.app(scope, receive, send)
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\fastapi\applications.py", line 270, in __call__    await super().__call__(scope, receive, send)
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\starlette\applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
    raise exc
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
    raise e
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\starlette\routing.py", line 706, in __call__   
    await route.handle(scope, receive, send)
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\starlette\routing.py", line 276, in handle     
    await self.app(scope, receive, send)
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\starlette\routing.py", line 66, in app
    response = await func(request)
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\fastapi\routing.py", line 237, in app
    raw_response = await run_endpoint_function(
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\fastapi\routing.py", line 163, in run_endpoint_function
    return await dependant.call(**values)
  File "E:\Programming\projects\fullstack-ai-chatbot\server\src\routes\chat.py", line 40, in token_generator
    json_client.jsonset(str(token), Path.rootPath(), chat_session.dict())
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\rejson\client.py", line 158, in jsonset        
    return self.execute_command('JSON.SET', *pieces)
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\redis\client.py", line 898, in execute_command 
    conn = self.connection or pool.get_connection(command_name, **options)
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\redis\connection.py", line 1192, in get_connection
    connection.connect()
  File "E:\Programming\projects\fullstack-ai-chatbot\server\env\lib\site-packages\redis\connection.py", line 563, in connect     
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 11001 connecting to AWS:15177. getaddrinfo failed.

Any ideas on how I can solve this?

I have tried changing the port and the redis host, but I am still having the same error.

Dan ndongi
  • 23
  • 1
  • 5
  • What address are you trying to connect to? It's trying to connect to the hostname "AWS", which is obviously not gonna resolve (unless you have a custom entry in your `hosts` file) – M.O. Feb 17 '23 at 08:49
  • What hostname should I use as the redis host? – Dan ndongi Feb 17 '23 at 13:26
  • Well, what is the redis host you're trying to connect to? – M.O. Feb 17 '23 at 14:08

0 Answers0