jhnnsrs / helloworld-standalone

0 stars 0 forks source link

Cannot connect to `localhost`? #4

Open beniroquai opened 2 days ago

beniroquai commented 2 days ago

Is it "allowed" to connect to the localhost from the python script? If so, it doesn't work:

with easy("TEST", url="localhost") as e:

gives

(chromatix) (base) Blynk:helloworld-standalone-master bene$ /Users/bene/mambaforge/envs/chromatix/bin/python /Users/bene/Downloads/helloworld-standalone-master/main.py
/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/_distutils_hack/__init__.py:26: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
Traceback (most recent call last):
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/connector.py", line 1073, in _wrap_create_connection
    sock = await aiohappyeyeballs.start_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohappyeyeballs/impl.py", line 104, in start_connection
    raise first_exception
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohappyeyeballs/impl.py", line 81, in start_connection
    sock = await _connect_sock(
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohappyeyeballs/impl.py", line 166, in _connect_sock
    await loop.sock_connect(sock, address)
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/asyncio/selector_events.py", line 638, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/asyncio/selector_events.py", line 678, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 61] Connect call failed ('192.168.43.235', 80)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/bene/Downloads/helloworld-standalone-master/main.py", line 88, in <module>
    e.run()
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/arkitekt_next/apps/types.py", line 33, in run
    self.services["rekuest"].run()
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rekuest_next/rekuest.py", line 49, in run
    return unkoil(self.arun, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/koil/helpers.py", line 143, in unkoil
    x, newcontext = co_future.result()
                    ^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/koil/helpers.py", line 133, in passed_with_context
    x = await coro(*args, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rekuest_next/rekuest.py", line 55, in arun
    await self.agent.aprovide()
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rekuest_next/agents/base.py", line 493, in aprovide
    await self.astart(instance_id=instance_id)
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rekuest_next/agents/base.py", line 391, in astart
    await self.aregister_definitions(instance_id=instance_id)
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rekuest_next/agents/base.py", line 325, in aregister_definitions
    x = await aensure_agent(
        ^^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rekuest_next/api/schema.py", line 1581, in aensure_agent
    await aexecute(
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rekuest_next/funcs.py", line 12, in aexecute
    x = await rath.aquery(
        ^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rath/rath.py", line 94, in aquery
    async for data in self.link.aexecute(op):
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rath/links/compose.py", line 119, in aexecute
    async for result in self._firstlink.aexecute(operation):
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rath/links/parsing.py", line 52, in aexecute
    async for result in self.next.aexecute(operation, **kwargs):
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rath/links/parsing.py", line 52, in aexecute
    async for result in self.next.aexecute(operation, **kwargs):
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rath/links/auth.py", line 86, in aexecute
    token = await self.aload_token(operation)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/herre_next/contrib/rath/auth_link.py", line 14, in aload_token
    return await herre.aget_token()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/herre_next/herre.py", line 116, in aget_token
    await self.arequest_from_grant(TokenRequest(context=kwargs))
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/herre_next/herre.py", line 157, in arequest_from_grant
    potential_token = await self.grant.afetch_token(request)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/herre_next/grants/oauth2/refresh.py", line 112, in afetch_token
    self._token = await self.grant.afetch_token(request)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/herre_next/fakts/grant.py", line 112, in afetch_token
    return await self._activegrant.afetch_token(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/herre_next/grants/oauth2/client_credentials.py", line 59, in afetch_token
    async with session.post(
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/client.py", line 1353, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/client.py", line 657, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/connector.py", line 564, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/connector.py", line 975, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/connector.py", line 1350, in _create_direct_connection
    raise last_exc
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/connector.py", line 1319, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/connector.py", line 1088, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.43.235:80 ssl:default [Connect call failed ('192.168.43.235', 80)]
(chromatix) (base) Blynk:helloworld-standalone-master bene$ 

Orkestrator sees the server as localhost

jhnnsrs commented 2 days ago

Oh it looks like I broke the cache hash... :D it looks like it thinks the server is still on the last address.. had a similar issue today. Best ist to delete the arkitekt_next folder so that the cache is gone.

On Tue, 29 Oct 2024, 14:17 Benedict Diederich, @.***> wrote:

Is it "allowed" to connect to the localhost from the python script? If so, it doesn't work:

with easy("TEST", url="localhost") as e:

gives

(chromatix) (base) Blynk:helloworld-standalone-master bene$ /Users/bene/mambaforge/envs/chromatix/bin/python /Users/bene/Downloads/helloworld-standalone-master/main.py/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/_distutils_hack/init.py:26: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.")Traceback (most recent call last): File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/connector.py", line 1073, in _wrap_create_connection sock = await aiohappyeyeballs.start_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohappyeyeballs/impl.py", line 104, in start_connection raise first_exception File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohappyeyeballs/impl.py", line 81, in start_connection sock = await _connect_sock( ^^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohappyeyeballs/impl.py", line 166, in _connect_sock await loop.sock_connect(sock, address) File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/asyncio/selector_events.py", line 638, in sock_connect return await fut ^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/asyncio/selector_events.py", line 678, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}')ConnectionRefusedError: [Errno 61] Connect call failed ('192.168.43.235', 80) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Users/bene/Downloads/helloworld-standalone-master/main.py", line 88, in e.run() File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/arkitekt_next/apps/types.py", line 33, in run self.services["rekuest"].run() File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rekuest_next/rekuest.py", line 49, in run return unkoil(self.arun, *args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/koil/helpers.py", line 143, in unkoil x, newcontext = co_future.result() ^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/concurrent/futures/_base.py", line 449, in result return self.get_result() ^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/concurrent/futures/_base.py", line 401, in get_result raise self._exception File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/koil/helpers.py", line 133, in passed_with_context x = await coro(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rekuest_next/rekuest.py", line 55, in arun await self.agent.aprovide() File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rekuest_next/agents/base.py", line 493, in aprovide await self.astart(instance_id=instance_id) File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rekuest_next/agents/base.py", line 391, in astart await self.aregister_definitions(instance_id=instance_id) File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rekuest_next/agents/base.py", line 325, in aregister_definitions x = await aensure_agent( ^^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rekuest_next/api/schema.py", line 1581, in aensure_agent await aexecute( File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rekuest_next/funcs.py", line 12, in aexecute x = await rath.aquery( ^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rath/rath.py", line 94, in aquery async for data in self.link.aexecute(op): File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rath/links/compose.py", line 119, in aexecute async for result in self._firstlink.aexecute(operation): File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rath/links/parsing.py", line 52, in aexecute async for result in self.next.aexecute(operation, kwargs): File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rath/links/parsing.py", line 52, in aexecute async for result in self.next.aexecute(operation, **kwargs): File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/rath/links/auth.py", line 86, in aexecute token = await self.aload_token(operation) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/herre_next/contrib/rath/auth_link.py", line 14, in aload_token return await herre.aget_token() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/herre_next/herre.py", line 116, in aget_token await self.arequest_from_grant(TokenRequest(context=kwargs)) File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/herre_next/herre.py", line 157, in arequest_from_grant potential_token = await self.grant.afetch_token(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/herre_next/grants/oauth2/refresh.py", line 112, in afetch_token self._token = await self.grant.afetch_token(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/herre_next/fakts/grant.py", line 112, in afetch_token return await self._activegrant.afetch_token(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/herre_next/grants/oauth2/client_credentials.py", line 59, in afetch_token async with session.post( File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/client.py", line 1353, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/client.py", line 657, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/connector.py", line 564, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/connector.py", line 975, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/connector.py", line 1350, in _create_direct_connection raise last_exc File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/connector.py", line 1319, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bene/mambaforge/envs/chromatix/lib/python3.11/site-packages/aiohttp/connector.py", line 1088, in _wrap_create_connection raise client_error(req.connection_key, exc) from excaiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.43.235:80 ssl:default [Connect call failed ('192.168.43.235', 80)] (chromatix) (base) Blynk:helloworld-standalone-master bene$

Orkestrator sees the server as localhost

— Reply to this email directly, view it on GitHub https://github.com/jhnnsrs/helloworld-standalone/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZLIEPSDKMN63RIYHNOLPLZ56DIBAVCNFSM6AAAAABQZ2TOV2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGYZDCMRTGIZDQMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jhnnsrs commented 2 days ago

pip install arkitekt-next[all]==0.8.27

Should fix the bug ;)

jhnnsrs commented 1 day ago

so stupid i ruined the agent by trying to fix it

pip install arkitekt-next[all]==0.8.29