hyperledger / aries-cloudagent-python

Hyperledger Aries Cloud Agent Python (ACA-Py) is a foundation for building decentralized identity applications and services running in non-mobile environments.
https://wiki.hyperledger.org/display/aries
Apache License 2.0
404 stars 511 forks source link

Create a wallet in an existing database #2154

Open ianco opened 1 year ago

ianco commented 1 year ago

For EC2 (and possibly other scenarios) aca-py needs to be able to create a wallet in an existing database. (The default behaviour is for aca-py to create the database if it doesn't exist.)

This used to work with indy-sdk and the postgres plug-in (at least according to my recollection) but now results in this error:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Db(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState("42P01"), message: "relation \"metadata\" does not exist", detail: None, hint: None, position: Some(Normal(19)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("parse_relation.c"), line: Some(1180), routine: Some("parserOpenTable") }))', src/postgres_storage.rs:1653:33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: PoisonError { .. }', src/lib.rs:890:56
stack backtrace:

The code tries to select from the metadata table (SELECT value FROM metadata) to check if the wallet exists and has been initialized, this is throwing a PoisonError which crashes the agent

WadeBarnes commented 1 year ago

@ianco, Which version of code/image were you using?

ianco commented 1 year ago

I was running locally. I tested different versions of the code (latest code, plus checking out older tags), but with the same rust version (I think it may be a rust version or postgres library version issue)

WadeBarnes commented 1 year ago

I ask, because that likely means the latest acay-py images are affected by this issue too. The 0.8.0-rc0 images from https://github.com/hyperledger/aries-cloudagent-python/pkgs/container/aries-cloudagent-python and https://hub.docker.com/r/bcgovimages/aries-cloudagent/tags

ianco commented 1 year ago

I've tried with a few different aca-py images and I haven't been able to get this to work (create a wallet in an existing database) with either indy or askar storage.

abramis commented 1 year ago

I didn't know that wallet can create on existing database. I use indy wallets with postgres and every time creates a new database for a single wallet. Use POST multitenancy/wallet on multitenant agents. With which service try to create a wallet on existing database? Maybe try it too. If this is possible, from the scope of performance, it sounds better to have many wallets on a database from having many databases-wallets.

MonolithicMonk commented 7 months ago

Did anyone ever find a solution for this. I'm currently having troubles integrating acapy with Hashicorp vault secrets management because the provisioned database throws the error aries_askar.error.AskarError: Backend error Caused by: error returned from database: relation "config" does not exist