Open LiranCohen opened 3 weeks ago
Hopefully connectedDid is the DID identifier, not some more complex thing?
Hopefully connectedDid is the DID identifier, not some more complex thing?
Yup! It is set to the identity.did.uri
further down the file if there is no agent passed.
When using
Web5.connect()
without any options, there have been occurrences where the following error is thrown:Uncaught (in promise) Error: connect() failed due to unexpected state: Expected 1 but found 2 stored identities.
When
connect()
is called and no identities are returned from the agent, a new identity is created. There is some unknown scenario whereuserAgent.identities.list()
is returning zero results, although there was one that existed in the past.On a subsequent call of
connect()
it will then suddenly have 2 identities. https://github.com/TBD54566975/web5-js/blob/main/packages/api/src/web5.ts#L205-L248For the time being we will do a few things to remedy the stuck situation, as well as investigate further as to why this happens.
processRequest
within theDwnDidStore.getAllRecords()
and throw an error along with the error detail if it does not return a 200 status. https://github.com/TBD54566975/web5-js/blob/main/packages/agent/src/store-did.ts#L48-L57connectedDid
and the list returns more than one identity, attempt to find the identity which matches theconnectedDid
, if it exists use that identity, otherwise fail.