Zero6992 / chatGPT-discord-bot

Integrate ChatGPT into your own discord bot
GNU General Public License v2.0
2.6k stars 699 forks source link

ERROR MESSAGE: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997) #464

Closed GeboArt closed 3 months ago

GeboArt commented 9 months ago

Technical information OS Name: Microsoft Windows 11 Home OS Version: 10.0.22621 N/A Build 22621 Virtual Environment Name: venvBotChatGPT Version: Python 3.10.9

(venvBotChatGPT) PS Z:\MyFolder\Discord\BotChatGPT> python main.py
2023-09-10 17:42:17 INFO     discord.client logging in using static token
2023-09-10 17:42:18 INFO     discord.gateway Shard ID None has connected to Gateway (Session ID: ad*****************32).
2023-09-10 17:42:20 INFO     src.log -> Send system prompt with size 11
2023-09-10 17:42:20 ERROR    src.log -> Error while sending system prompt: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)

Traceback (most recent call last):
  File "Z:\MyFolder\Discord\BotChatGPT\src\aclient.py", line 146, in send_start_prompt
    response = f"{response}{await responses.unofficial_handle_response(self.starting_prompt, self)}"
  File "Z:\MyFolder\Discord\BotChatGPT\src\responses.py", line 11, in unofficial_handle_response
    async for response in client.chatbot.ask(message):
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\revChatGPT\V1.py", line 1331, in ask
    async for msg in self.post_messages(
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\revChatGPT\V1.py", line 1282, in post_messages
    async for msg in self.__send_request(
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\revChatGPT\V1.py", line 1114, in __send_request
    async with self.session.stream(
  File "X:\Users\Username\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\httpx\_client.py", line 1573, in stream
    response = await self.send(
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\httpx\_client.py", line 1617, in send
    response = await self._send_handling_auth(
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\httpx\_client.py", line 1645, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\httpx\_client.py", line 1682, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\httpx\_client.py", line 1719, in _send_single_request
    response = await transport.handle_async_request(request)
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\httpx\_transports\default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\httpcore\_async\connection_pool.py", line 262, in handle_async_request
    raise exc
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\httpcore\_async\connection_pool.py", line 245, in handle_async_request
    response = await connection.handle_async_request(request)
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\httpcore\_async\connection.py", line 92, in handle_async_request
    raise exc
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\httpcore\_async\connection.py", line 69, in handle_async_request
    stream = await self._connect(request)
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\httpcore\_async\connection.py", line 149, in _connect
    stream = await stream.start_tls(**kwargs)
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\httpcore\_backends\anyio.py", line 78, in start_tls
    raise exc
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\httpcore\_backends\anyio.py", line 69, in start_tls
    ssl_stream = await anyio.streams.tls.TLSStream.wrap(
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\anyio\streams\tls.py", line 125, in wrap
    await wrapper._call_sslobject_method(ssl_object.do_handshake)
  File "Z:\MyFolder\Discord\BotChatGPT\venvBotChatGPT\lib\site-packages\anyio\streams\tls.py", line 133, in _call_sslobject_method
    result = func(*args)
  File "X:\Users\Username\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 975, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)
2023-09-10 17:42:20 INFO     src.log -> ChatGPT3.5#8219 is now running!
GeboArt commented 9 months ago

I analyzed this situation again, the error only appears when I have Cloudflare WARP active.

I thought it might be being blocked by the configurations of this Firewall, so I added a rule so that the openai URL is not scanned, but it didn't work.