openwallet-foundation / acapy

ACA-Py is a foundation for building decentralized identity applications and services running in non-mobile environments.
https://aca-py.org
Apache License 2.0
419 stars 512 forks source link

:bug: Attempting to create a did-exchange request for `their_public_did` without services results in Internal Server Error #3297

Closed ff137 closed 1 month ago

ff137 commented 1 month ago

Using a bad their_public_did (such as did:key, without services) in creating a did-exchange request, raises an unhandled exception:

...
  File "/home/aries/.local/lib/python3.12/site-packages/aiohttp_apispec/middlewares.py", line 51, in validation_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/admin/decorators/auth.py", line 72, in tenant_auth
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/protocols/didexchange/v1_0/routes.py", line 334, in didx_create_request_implicit
    didx_request = await didx_mgr.create_request_implicit(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/protocols/didexchange/v1_0/manager.py", line 301, in create_request_implicit
    request = await self.create_request(  # saves and updates conn_rec
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/protocols/didexchange/v1_0/manager.py", line 374, in create_request
    services = await self.resolve_didcomm_services(conn_rec.their_public_did)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/connections/base_manager.py", line 451, in resolve_didcomm_services
    raise BaseConnectionManagerError(
aries_cloudagent.connections.base_manager.BaseConnectionManagerError: Cannot connect via DID that has no associated services

This is because BaseConnectionManagerError is not handled in the DIDXManager.