bcgov/issuer-kit

Credential Exchange - 'cred_def_id': ['Missing data for required field.'] - aries-agent calling create method Error: Request failed with status code 422

dinbtechit opened this issue · 1 comments

The issuer gets stuck while issuing credentials to the BC wallet agent. Any help on how to resolve this error is much appreciated. Thanks in advance!

Screen Shot 2022-08-29 at 9 37 18 AM

Browser Console logs:

Screen Shot 2022-08-29 at 9 52 53 AM

Server Logs:

I see the following error in the logs.. marshmallow.exceptions.ValidationError: {'cred_def_id': ['Missing data for required field.']}

api_1               | debug: Creating new credential exchange
agent_1             | 2022-08-29 02:35:59,651 aries_cloudagent.admin.server ERROR Handler error with exception: Unprocessable Entity
agent_1             | 
agent_1             | =================
agent_1             | Traceback (most recent call last):
agent_1             |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/webargs/asyncparser.py", line 90, in parse
agent_1             |     result = schema.load(parsed)
agent_1             |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/marshmallow/schema.py", line 723, in load
agent_1             |     data, many=many, partial=partial, unknown=unknown, postprocess=True
agent_1             |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/marshmallow/schema.py", line 904, in _do_load
agent_1             |     raise exc
agent_1             | marshmallow.exceptions.ValidationError: {'cred_def_id': ['Missing data for required field.']}
agent_1             | 
agent_1             | During handling of the above exception, another exception occurred:
agent_1             | 
agent_1             | Traceback (most recent call last):
agent_1             |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/aries_cloudagent/admin/server.py", line 159, in ready_middleware
agent_1             |     return await handler(request)
agent_1             |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/aries_cloudagent/admin/server.py", line 196, in debug_middleware
agent_1             |     return await handler(request)
agent_1             |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/aiohttp_apispec/middlewares.py", line 34, in validation_middleware
agent_1             |     schema["schema"], request, locations=schema["locations"]
agent_1             |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/webargs/asyncparser.py", line 95, in parse
agent_1             |     error, req, schema, error_status_code, error_headers
agent_1             |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/webargs/asyncparser.py", line 108, in _on_validation_error
agent_1             |     await error_handler(error, req, schema, error_status_code, error_headers)
agent_1             |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/webargs/aiohttpparser.py", line 166, in handle_error
agent_1             |     content_type="application/json",
agent_1             | aiohttp.web_exceptions.HTTPUnprocessableEntity: Unprocessable Entity
api_1               | Error in aries-agent calling create  method Error: Request failed with status code 422
api_1               |     at createError (/opt/app-root/src/node_modules/axios/lib/core/createError.js:16:15)
api_1               |     at settle (/opt/app-root/src/node_modules/axios/lib/core/settle.js:17:12)
api_1               |     at IncomingMessage.handleStreamEnd (/opt/app-root/src/node_modules/axios/lib/adapters/http.js:269:11)
api_1               |     at IncomingMessage.emit (events.js:326:22)
api_1               |     at endReadableNT (_stream_readable.js:1241:12)
api_1               |     at processTicksAndRejections (internal/process/task_queues.js:84:21) {
api_1               |   config: {
api_1               |     url: 'http://agent:8024/issue-credential/send-offer',
api_1               |     method: 'post',
api_1               |     data: '{"connection_id":"7522936f-348c-42c0-8dbf-3710688a3801","comment":"Credential offer from Issuer Name","credential_preview":{"@type":"did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/issue-credential/1.0/credential-preview","attributes":[{"name":"country","value":"Canada","mime-type":"text/plain"},{"name":"issued","value":"2022-08-29T02:35:05.201Z","mime-type":"text/plain"},{"name":"given_names","value":"Dinesh","mime-type":"text/plain"},{"name":"family_name","value":"Admin","mime-type":"text/plain"},{"name":"birthdate","value":"1980-01-01","mime-type":"text/plain"},{"name":"street_address","value":"asdfasfasf","mime-type":"text/plain"},{"name":"postal_code","value":"B3K 2S3","mime-type":"text/plain"},{"name":"locality","value":"Halifax","mime-type":"text/plain"},{"name":"region","value":"NS","mime-type":"text/plain"}]},"auto_issue":false}',

I managed to resolve that error.. Think the issue was due to... switching back and forth between local mode and dev mode. I think it messed up the cred_def. After starting over from scratch I no longer see the error.

Started the service in this order:

  1. Von-network
  2. issuer-kit in local mode
  3. BC Wallet (with metro port set to 10001 to prevent default port 8081 conflict with issuer-kit - export RCT_METRO_PORT=10001)