Server error on incorrect inputs on credential proposal
Hi all,
I am new to the Hyperledger Aries space and am attempting to walk through some basic connection and issuance steps between two agents, Alice and Bob. I am running the ACA-py agents on my local machine - MacBook Pro M1, Ventura 13.2.1 - using the Docker script in scripts/run_docker. I have previously had an issue with the ARM chip with initialising the agents in issue #2311 which has since been fixed by PR #2313.
I have set up a von-network on my local machine, submitted a public DID for Alice, and then initialised the Alice and Bob agents using the below commands:
Alice
PORTS="8000:8000 11000:11000" scripts/run_docker start \
--label Alice \
--inbound-transport http 0.0.0.0 8000 \
--outbound-transport http \
--admin 0.0.0.0 11000 \
--admin-insecure-mode \
--genesis-url http://host.docker.internal:9000/genesis \
--seed Alice000000000000000000000000001 \
--endpoint http://host.docker.internal:8000/ \
--debug-connections \
--wallet-type askar \
--wallet-name Alice1 \
--wallet-key secret \
--auto-provision \
--auto-accept-invites \
--auto-accept-requests \
--auto-ping-connection \
--auto-respond-credential-proposal \
--auto-respond-credential-offer \
--auto-respond-credential-request \
--auto-store-credential
Bob
PORTS="8001:8001 11001:11001" scripts/run_docker start \
--label Bob \
-it http 0.0.0.0 8001 \
-ot http \
--admin 0.0.0.0 11001 \
--admin-insecure-mode \
--endpoint http://host.docker.internal:8001/ \
--genesis-url http://host.docker.internal:9000/genesis \
--debug-connections \
--wallet-local-did \
--wallet-type askar \
--wallet-name Bob1 \
--wallet-key secret \
--auto-provision \
--auto-accept-invites \
--auto-accept-requests \
--auto-ping-connection \
--auto-respond-credential-proposal \
--auto-respond-credential-offer \
--auto-respond-credential-request \
--auto-store-credential
I have then connected the agents by creating an OOB invitation with Alice out-of-band/create-invitation with the following protocol:
{
"handshake_protocols": [
"did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/didexchange/1.0"
],
"use_public_did": false
}
This was then received by Bob using out-of-band/receive-invitation and completed on both ends successfully. Finally, a schema and credential definition are published to the ledger using Alice:
{
"attributes": [
"name",
"age"
],
"schema_name": "my-schema",
"schema_version": "1.0"
}
Bob then attempts a credential proposal:
curl -X POST http://localhost:11001/issue-credential-2.0/send-proposal \
-H "Content-Type: application/json" -d '{
"comment": "I want this",
"connection_id": "fb5793a9-a1ce-43ac-a549-71ff700d4b94",
"credential_preview": {
"@type": "issue-credential/2.0/credential-preview",
"attributes": [
{
"mime-type": "plain/text",
"name": "name",
"value": "Bob"
},
{
"mime-type": "plain/text",
"name": "age",
"value": "30"
}
]
},
"filter": {
"dif": {},
"indy": {}
}
}'
which causes a 500 error on the Bob agent and the following error log:
File "/aries_cloudagent/admin/server.py", line 442, in setup_context
return await task
File "/usr/local/lib/python3.9/asyncio/futures.py", line 284, in __await__
yield self # This tells Task to wait for completion.
File "/usr/local/lib/python3.9/asyncio/tasks.py", line 328, in __wakeup
future.result()
File "/usr/local/lib/python3.9/asyncio/futures.py", line 201, in result
raise self._exception
File "/usr/local/lib/python3.9/asyncio/tasks.py", line 256, in __step
result = coro.send(None)
File "/aries_cloudagent/protocols/issue_credential/v2_0/routes.py", line 775, in credential_exchange_send_proposal
cred_ex_record = await cred_manager.create_proposal(
File "/aries_cloudagent/protocols/issue_credential/v2_0/manager.py", line 133, in create_proposal
formats = [
File "/aries_cloudagent/protocols/issue_credential/v2_0/manager.py", line 134, in <listcomp>
await fmt.handler(self._profile).create_proposal(cred_ex_record, filter)
AttributeError: 'NoneType' object has no attribute 'handler'
I have restarted all agents and ledger several times with the above steps and the error persists, is this another issue caused by the ARM chip or is there a separate issue which I'm missing here? Thank you for any and all help!
I'll take a quick look and see if I can reproduce the issue -- what branch/version of ACA-Py do you have checked out?
I am using v0.8.2 and on the feature/arm-mac-workaround branch which I just added a PR for to fix dependency issues with ARM chips which you can find in issue #2311
With those inputs, the issue is reproducible. I'll dig around some more. It's been a minute since I looked at credential proposals in issue credential v2.
curl -X POST http://localhost:11001/issue-credential-2.0/send-proposal \
-H "Content-Type: application/json" -d '{
"comment": "I want this",
"connection_id": "fb5793a9-a1ce-43ac-a549-71ff700d4b94",
"credential_preview": {
"@type": "issue-credential/2.0/credential-preview",
"attributes": [
{
"mime-type": "plain/text",
"name": "name",
"value": "Bob"
},
{
"mime-type": "plain/text",
"name": "age",
"value": "30"
}
]
},
"filter": {
"indy": {}
}
}'
Try this. dif: {} removed from the filter. dif is a supported filter on presentations but not on issuance -- the format attachment for issuance that corresponds to dif is ld_proof. In this case, we want to issue an anoncreds credential so we only need the indy filter. In practice, the indy filter would be populated with specifications such as from which cred def the holder wants to receive the credential.
I think this solves your issue but I think ACA-Py should handle this better. Mistaking one filter string for another is an easy one to make. ACA-Py should gracefully fail and report that dif isn't a supported filter value in issue credential protocol.
That makes a lot of sense thank you very much! To mitigate this issue in the future where could I find documentation on the correct inputs to use for the ACA-py agent APIs?
I've also now tried to respond to the proposal from 'Bob' with an offer from 'Alice' but I can't find where Alice's ID for the record is, it didn't appear in the server logs or in the output of Bob's response. I tried searching /issue-credential-2.0/records endpoint with the correct connection_id but nothing appeared. Do you know where I could find it?
The endpoint for Alice's offer is /issue-credential-2.0/records/{cred_ex_id}/send-offer.
The set of flags you specified probably caused the exchange to complete automatically:
...
--auto-respond-credential-proposal \
--auto-respond-credential-offer \
--auto-respond-credential-request \
--auto-store-credential
You should see the credential on the holder agent under GET /credentials.
Re: Docs for the Admin API, are you aware of the of the swagger UI? You can find it by navigating to http://localhost:11000/api/doc for your Alice agent, and swapping 11000 for 11001 for Bob. There are also a few docs:
- https://github.com/hyperledger/aries-cloudagent-python/blob/main/AdminAPI.md
- https://github.com/hyperledger/aries-cloudagent-python/blob/main/demo/README.md
Ah yup that makes sense I forgot about that flag, thank you!
I'll take a look at those links, I have been using swagger but I've found that sometimes its examples are more complicated / bloated than the payload often needs to be. Thank you for your help @dbluhm!