WebOfTrust / keria

KERI Agent in the cloud
https://keria.readthedocs.io/en/latest/
Apache License 2.0
18 stars 28 forks source link

Internal Server Error when listing credential from issuer without witness #121

Closed lenkan closed 10 months ago

lenkan commented 10 months ago

Steps to reproduce:

Dependencies

In keria

pip install -r requirements.txt --force-reinstall
keria start --config-dir scripts --config-file demo-witness-oobis

In keripy

pip install -r requirements.txt --force-reinstall
kli witness demo

In vLEI

pip install -r requirements.txt --force-reinstall
vLEI-server -s ./schema/acdc -c ./samples/acdc/ -o ./samples/oobis/

Repro

Check out PR branch from signifypy https://github.com/WebOfTrust/signifypy/pull/94 Change this line: https://github.com/WebOfTrust/signifypy/pull/94/files#diff-9f80d43d6bd610fac856c033a1f80eb9cd12a0490e2caea08cb2c21175e34c6eR25 to

WITNESS_AIDS=[]

Then do

pip install -r requirements.txt --force-reinstall
python scripts/single-issuer-holder.py

Actual result

Scripts fail with error

Listing credentials...
Traceback (most recent call last):
  File "/home/lenkan/code/signifypy/scripts/single-issuer-holder.py", line 183, in <module>
    run()
  File "/home/lenkan/code/signifypy/scripts/single-issuer-holder.py", line 174, in run
    credentials = holder_client.credentials().list('holder', filtr={})
  File "/home/lenkan/code/signifypy/src/signify/app/credentialing.py", line 145, in list
    res = self.client.post(f"/identifiers/{name}/credentials/query", json=json)
  File "/home/lenkan/code/signifypy/src/signify/app/clienting.py", line 186, in post
    self.raiseForStatus(res)
  File "/home/lenkan/code/signifypy/src/signify/app/clienting.py", line 290, in raiseForStatus
    raise HTTPError(http_error_msg, response=res)
requests.exceptions.HTTPError: 500 Server Error: 500 Internal Server Error for url: http://127.0.0.1:3901/identifiers/holder/credentials/query

Expected result

Script succeeds.

Additional notes.

This is the trace from keria:

2023-11-07 08:14:23 [FALCON] [ERROR] POST /identifiers/holder/credentials/query => Traceback (most recent call last):
  File "falcon/app.py", line 365, in falcon.app.App.__call__
  File "/home/lenkan/code/keria/src/keria/app/credentialing.py", line 390, in on_post
    creds = agent.rgy.reger.cloneCreds(saids=saids)
  File "/home/lenkan/code/keria/.venv/lib/python3.10/site-packages/keri/vdr/viring.py", line 344, in cloneCreds
    status = self.tevers[regk].vcState(saider.qb64)
  File "/home/lenkan/code/keria/.venv/lib/python3.10/site-packages/keri/vdr/viring.py", line 46, in __getitem__
    raise ex  # reraise KeyError
  File "/home/lenkan/code/keria/.venv/lib/python3.10/site-packages/keri/vdr/viring.py", line 41, in __getitem__
    return super(RegerDict, self).__getitem__(k)
KeyError: 'ELYpIwS7jz0lwytVM8kEAfnwiwm-.....'

If it is by design that you should not be able to issue credentials from an AID without witnesses, then we could probably validate this when creating the credential to avoid the internal server error?

m00sey commented 10 months ago

fixed by #122