germanoeich/nirn-proxy

Context deadline exceeded

jaymart95 opened this issue · 3 comments

Im using hikari and I replaced the url with http://proxy.vanityroles.com which is pointing to the container running the proxy. In the container logs anytime the bot tries to connect to it it says this

time="2024-02-02T22:57:01Z" level=warning msg="Get \"https://discord.com/gateway/bot?\": context deadline exceeded" clientIp="172.23.0.1:45112" forwardedFor="184.14.252.253, 172.69.59.182" function=Queue waitedFor=5.004119867s

Im not sure what im doing wrong here.

okay so I made some progress and just pointed straight to the IP and port and now im receiving

hikari.errors.NotFoundError: Not Found 404: '<!DOCTYPE html><html lang="en-US">
<head>
  <meta charset="utf-8" />
  <meta name="google-site-verification" content="nubQ83kz2YYRrleJaYf_CYbvDZ6lXVl-NL_MWX1Uj9Y" />
  <meta name="msvalidate.01" conte...' for http://192.168.1.11:7878/gateway/bot

in bot logs

in the proxy log i do receive

time="2024-02-02T23:05:54Z" level=info msg="Created new queue" bufferSize=50 globalLimit=50 identifier="Vanity Roles Dev#3883"

I set to debug and receive

time="2024-02-03T00:49:51Z" level=info msg="Created new queue" bufferSize=50 globalLimit=50 identifier="Vanity Roles Dev#3883"
time="2024-02-03T00:49:51Z" level=debug msg="Discord request" discordBucket= method=GET path=/gateway/bot status="404 OK"

but within the bot I receive

E 2024-02-02 19:49:50,649 root: Not Found 404: '<!DOCTYPE html><html lang="en-US">
<head>
  <meta charset="utf-8" />
  <meta name="google-site-verification" content="nubQ83kz2YYRrleJaYf_CYbvDZ6lXVl-NL_MWX1Uj9Y" />
  <meta name="msvalidate.01" conte...' for http://192.168.1.11:7878/gateway/bot
Traceback (most recent call last):
  File "c:\Users\jmart\Documents\GitHub\hikari-rewrite\src\launcher.py", line 14, in main
    bot.run()
  File "C:\Users\jmart\AppData\Local\Programs\Python\Python310\lib\site-packages\hikari\impl\gateway_bot.py", line 812, in run
    loop.run_until_complete(
  File "C:\Users\jmart\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "C:\Users\jmart\AppData\Local\Programs\Python\Python310\lib\site-packages\hikari\impl\gateway_bot.py", line 932, in start
    requirements = await self._rest.fetch_gateway_bot_info()
  File "C:\Users\jmart\AppData\Local\Programs\Python\Python310\lib\site-packages\hikari\impl\rest.py", line 2030, in fetch_gateway_bot_info
    response = await self._request(route)
  File "C:\Users\jmart\AppData\Local\Programs\Python\Python310\lib\site-packages\hikari\impl\rest.py", line 732, in _request
    await aio.first_completed(request_task, self._close_event.wait())
  File "C:\Users\jmart\AppData\Local\Programs\Python\Python310\lib\site-packages\hikari\internal\aio.py", line 135, in first_completed
    await next(iterator)
  File "C:\Users\jmart\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 571, in _wait_for_one
    return f.result()  # May raise f.exception().
  File "C:\Users\jmart\AppData\Local\Programs\Python\Python310\lib\site-packages\hikari\impl\rest.py", line 905, in _perform_request
    raise await net.generate_error_response(response)
hikari.errors.NotFoundError: Not Found 404: '<!DOCTYPE html><html lang="en-US">
<head>
  <meta charset="utf-8" />
  <meta name="google-site-verification" content="nubQ83kz2YYRrleJaYf_CYbvDZ6lXVl-NL_MWX1Uj9Y" />
  <meta name="msvalidate.01" conte...' for http://192.168.1.11:7878/gateway/bot

@jaymart95 Hello there! The route is wrong, it is pointing to /gateway/bot instead of /api/gateway/bot, which is why you are getting html and 404s. I'm not familiar with Hikari or Python, but if you give me more details of the changes your performed on the lib I could possibly aid you further. Otherwise, if Hikari supports a proxy and you are using this feature then you'd be better off opening an issue on their github, as this smells like a bug.