hyperledger / identus-edge-agent-sdk-ts

Apache License 2.0
15 stars 8 forks source link

agent.addListener works intermitently? #172

Open mixmix opened 5 months ago

mixmix commented 5 months ago

Is this a regression?

Yes

Description

Listening with agent.addListener('message', cb) for thid + piuri:

  0e9722e7-4eb6-4ec1-80d3-e50763621ba4 https://didcomm.org/issue-credential/3.0/issue-credential

Arrived:

✗ 8593b398-0cb2-4a73-8a09-7340dfa8b84f https://didcomm.org/issue-credential/3.0/offer-credential
(timeout after 60 seconds of waiting)

But what's this....messages found with agent.pluto.getAllMessages:

[
  '66e60595-c9a0-4a54-a34f-efb1b5c59dbe https://atalaprism.io/mercury/connections/1.0/request',
  '0e9722e7-4eb6-4ec1-80d3-e50763621ba4 https://didcomm.org/issue-credential/3.0/request-credential',
  '0e9722e7-4eb6-4ec1-80d3-e50763621ba4 https://didcomm.org/issue-credential/3.0/issue-credential', // <<<
  'cad05301-56e1-41cf-b578-bd479631ffa7 https://atalaprism.io/mercury/connections/1.0/request',
  '0e9722e7-4eb6-4ec1-80d3-e50763621ba4 https://didcomm.org/issue-credential/3.0/offer-credential',
  '66e60595-c9a0-4a54-a34f-efb1b5c59dbe https://atalaprism.io/mercury/connections/1.0/response',
  '0e9722e7-4eb6-4ec1-80d3-e50763621ba4 https://didcomm.org/issue-credential/3.0/request-credential',
  'cad05301-56e1-41cf-b578-bd479631ffa7 https://atalaprism.io/mercury/connections/1.0/response',
  '8593b398-0cb2-4a73-8a09-7340dfa8b84f https://didcomm.org/issue-credential/3.0/offer-credential'
]

Match is seen as 3rd entry in Array

Please provide the exception or error you saw

Not an exception, was just expecting an new matching "Messsage" to trigger.

Interestingly I see this one test working in a particular test, but when I run a suite of tests (in series) what I see is this test failing (it runs after another test... but the location of the tests paths should be different and the runs should be clean...)

Please provide the environment you discovered this bug in

No response

Anything else?

Here's what it looks like with events when this test is run in isolation:

Listening with agent.addListener('message', db) for thid + piuri:

      0b5a2790-1342-43a4-b36d-3ab5b08d8ce3 https://didcomm.org/issue-credential/3.0/issue-credential

Arrived:

    ✗ 0b5a2790-1342-43a4-b36d-3ab5b08d8ce3 https://didcomm.org/issue-credential/3.0/offer-credential
    ✓ 0b5a2790-1342-43a4-b36d-3ab5b08d8ce3 https://didcomm.org/issue-credential/3.0/issue-credential

Yay! it arrived here

elribonazo commented 5 months ago

@mixmix can u show me how are you doing the listening part in your tests?

I wonder if you are really listening to 1 listener or multiple ones and whats going on.

elribonazo commented 5 months ago

are u calling agent stop by any change after each test runs?

mixmix commented 3 months ago

No. This is in 4.0.2

i have just coded to give up on the listener after 60s, then search for the message via pluto.getAllMessages, match on piuri + thid and it' ALWAYS there 😅

mixmix commented 3 months ago

Here's code. See HACK comment

https://gitlab.com/ahau/lib/ssb-plugins/ssb-atala-prism/-/blob/master/index.js?ref_type=heads#L130

mkbreuningIOHK commented 2 months ago

@mixmix , could you tell if this issue is still applicable as it's been more than a month without an update. cc @elribonazo