Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OOB Multiuse invitations not emitting expected done webhook #2859

Closed
dbluhm opened this issue Mar 27, 2024 · 15 comments
Closed

OOB Multiuse invitations not emitting expected done webhook #2859

dbluhm opened this issue Mar 27, 2024 · 15 comments
Assignees
Labels
Discuss Issues to be raised for discussion at an ACA-Pug Meeting

Comments

@dbluhm
Copy link
Contributor

dbluhm commented Mar 27, 2024

Sometime between main and 0.11.0, we've lost a webhook of topic out_of_band, state done being emitted from ACA-Py when a connection has been completed through multiuse OOB invitations.

This is a breaking change that makes it difficult for controllers to determine when a connection was formed through an invitation intended to trigger a flow (e.g. with goal codes).

@swcurran
Copy link
Contributor

@ianco — do you have some time to investigate this?

@ianco
Copy link
Contributor

ianco commented Mar 28, 2024

@ianco — do you have some time to investigate this?

I will take a look!

@ianco ianco self-assigned this Mar 28, 2024
@ianco
Copy link
Contributor

ianco commented Mar 28, 2024

Would be nice if the integration tests also tested for receipt of webhooks ... I added a ticket for that awhile back (#2675)

@swcurran swcurran added the Discuss Issues to be raised for discussion at an ACA-Pug Meeting label Apr 2, 2024
@swcurran
Copy link
Contributor

swcurran commented Apr 2, 2024

Needed for 0.12.0

@ianco
Copy link
Contributor

ianco commented Apr 2, 2024

@dbluhm can you confirm everything was working properly in 0.11.0?

I can only find 2 commits that may have impacted this, one of yours (to oob_manager) (I don't think this is causing an issue):

2fa5282

And (the more likely one) of mine, dealing with a different webhook issue:

62ec2c0

... although I can't see where a webhook that had been previously emitted has been removed ...

I'll pull the 0.11.0 version and try it out ...

@dbluhm
Copy link
Contributor Author

dbluhm commented Apr 2, 2024

I can do a quick test run and should be able to provide a link to an easy to run example

@dbluhm
Copy link
Contributor Author

dbluhm commented Apr 2, 2024

Minimal reproducible example of it working on 0.11.0 found here:

https://github.com/Indicio-tech/acapy-minimal-example/tree/test/oob-0.11.0/examples/simple

git clone https://github.com/Indicio-tech/acapy-minimal-example.git
cd acapy-minimal-example/examples/simple
git checkout test/oob-0.11.0
docker-compose run example
# cleaning up
docker-compose down -v

@dbluhm
Copy link
Contributor Author

dbluhm commented Apr 2, 2024

A quick log of the output from that branch attached.

Hopefully it's easy enough to parse!
0.11.0.log

@ianco
Copy link
Contributor

ianco commented Apr 3, 2024

@dbluhm thanks looking at this now ...

@dbluhm
Copy link
Contributor Author

dbluhm commented Apr 3, 2024

Might be relevant, I recently realized that in order for the queued events to be emitted from a transaction, the transaction must be explicitly committed; e.g.:

async with profile.transaction() as txn:
    # do some stuff...
    await rec.save(txn)
    await txn.commit()

Discovered this while doing the multi-use respond in kind fix

@ianco
Copy link
Contributor

ianco commented Apr 3, 2024

With the aca-py 0.11.0 version, Alice receives a request webhook, and then done.

With the latest aca-py Alice receives an init webhook, and then a request (and then no done).

So there's a new init webhook as well as the missing done.

@ianco
Copy link
Contributor

ianco commented Apr 3, 2024

Might be relevant, I recently realized that in order for the queued events to be emitted from a transaction, the transaction must be explicitly committed; e.g.:

Yes this is my commit that I referenced above.

@dbluhm
Copy link
Contributor Author

dbluhm commented Apr 3, 2024

Yes, the init webhook is one that I added here: https://github.com/hyperledger/aries-cloudagent-python/blob/main/aries_cloudagent/protocols/didexchange/v1_0/manager.py#L715-L719

With the open question of whether we should suppress the new webhook. Originally, the logic was resulting in a race condition that we worked around by adding a transaction for saving the conn rec and attaching the request.

@ianco
Copy link
Contributor

ianco commented Apr 3, 2024

Aha this commit is what caused this issue: 76a1d26

In oob_processor.py we check if the OOB record is multi-use, and if not then we emit the done event. Since the multi_use flag wasn't getting saved we always emitted the event.

I'll update the oob_processor to always emit the done event even for mult_use.

@ianco
Copy link
Contributor

ianco commented Apr 3, 2024

PS @dbluhm that simple example of yours was super useful. @swcurran we should link to this from aca-py somewhere, and I'm going to steal your method of checking for webhooks for the aca-py integration tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discuss Issues to be raised for discussion at an ACA-Pug Meeting
Projects
None yet
Development

No branches or pull requests

3 participants