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
412 stars 512 forks source link

Endorser: Invalid request JSON: protocolVersion not found #2007

Closed dbluhm closed 8 months ago

dbluhm commented 1 year ago

On POST /transactions/{transaction_id}/endorse for a NYM transaction from an author, we get a 400 error when using the askar wallet type:

400: Cannot endorse invalid request. Invalid request JSON: protocolVersion not found.

It would seem that the indy-sdk defaults to protocolVersion of 2 when absent but indy-vdr requires that it be explicitly set.

@ianco @swcurran

dbluhm commented 1 year ago

This was tested on ACA-Py 0.7.5

dbluhm commented 1 year ago

This seems to be related to these recently changed lines:

https://github.com/hyperledger/aries-cloudagent-python/blob/main/aries_cloudagent/ledger/routes.py#L305-L321

The transaction data passed to the endorser does not include the protocolVersion. It also does not include a reqId which caused additional failures, even after switching to the indy wallet:

400: Exception raised by ledger transaction: Error: Invalid structure. Caused by: Request is invalid json: Error("missing field `reqId`", line: 1, column: 244). CommonInvalidStructure.. Exception raised by ledger transaction: Error: Invalid structure. Caused by: Request is invalid json: Error("missing field `reqId`", line: 1, column: 244). CommonInvalidStructure.
swcurran commented 1 year ago

@ianco --- and this one? :-)

ianco commented 1 year ago

@dbluhm can you provide your full configuration?

I tested with the endorser service (https://github.com/hyperledger/aries-endorser-service) and it worked with both aca-py releases 07.5 and 1.0.0-rc1

hangindev commented 1 year ago

I encountered the same error message when I tried to have an Author creates a DID and promote to public with the help with a Endorser.

I ran two agents using image "bcgovimages/aries-cloudagent:py36-1.16-1_0.7.5". Steps to reproduce:

  1. Establish connection and set up endorser role/info
  2. Author creates a local DID and POST /ledger/register-nym, specifying conn_id and create_transaction_for_endorser.
  3. Author POST /transactions/create-request.
  4. Endorser POST /transactions/{tran_id}/endorse
  5. Got response "400: Cannot endorse invalid request. Invalid request JSON: protocolVersion not found."

Any pointers would be appreciate. Thank you!

The docker compose file I used to set up two agents:

version: "3.9"
services:

  author:
    image: bcgovimages/aries-cloudagent:py36-1.16-1_0.7.5
    ports:
      - "8020:8020"
      - "8021:8021"
    command: "start \
      --label my-aries-agent \
      --genesis-url http://172.17.0.1:9000/genesis \
      --endpoint http://172.17.0.1:8020 \
      --inbound-transport http 0.0.0.0 8020 \
      --outbound-transport http \
      --webhook-url http://172.17.0.1:8022/acapy-webhook \
      --admin 0.0.0.0 8021 \
      --admin-insecure-mode \
      --wallet-type askar \
      --wallet-name my-wallet \
      --wallet-key my-wallet-password \ 
      --auto-provision \
      --auto-ping-connection"

  endorser:
    image: bcgovimages/aries-cloudagent:py36-1.16-1_0.7.5
    ports:
      - "8030:8030"
      - "8031:8031"
    command: "start \
      --label my-aries-agent \
      --genesis-url http://172.17.0.1:9000/genesis \
      --endpoint http://172.17.0.1:8030 \
      --inbound-transport http 0.0.0.0 8030 \
      --outbound-transport http \
      --webhook-url http://172.17.0.1:8022/acapy-webhook \
      --admin 0.0.0.0 8031 \
      --admin-insecure-mode \
      --wallet-type askar \
      --wallet-name my-wallet \
      --wallet-key my-wallet-password \
      --auto-provision \
      --auto-ping-connection"
dbluhm commented 8 months ago

I'm going to close this as stale. Endorser is being reworked for use with anoncreds-rs.