mattrglobal / osma

An open source mobile agent for achieving SSI
Apache License 2.0
40 stars 28 forks source link

Getting an error 'failed to create a2a request' while connecting with aries-framework-dotnet Web Agent from OSMA #40

Closed x0axz closed 4 years ago

x0axz commented 4 years ago

After QR Scan on OSMA to make a connection with aries-framework-dotnet Web Agent, I get the following error.

Error Log on OSMA

Failed to send A2A message with an HTTP status code of InternaIServerError and content Hyperledger.Aries. AriesFrameworkException: Failed to un-pack message -> Hyperledger.lndy.WaI|etApi.Wal letltemNotFoundException: No value with the specified key exists in the wallet from which it was requested. 

at Hyperledger.Aries.Utils.Cr yptoUtils.UnpackAsync(Wallet wallet, Bytel] message) in /src/ src/Hyperledger.Aries/Utils/ CryptoUtils.cs:|ine 66 

at Hyperledger.Aries.Agents.Agen tBase.UnpackAsync(lAgentContext agentContext, PackedMessageContext message) in /src/src/ Hyperledger.Aries/Agents/ AgentBase.cs:line 170 

-End of inner exception stack trace -

at Hyperledger.Aries.Agents.Agen tBase.UnpackAsync(lAgentContext agentContext, PackedMessageContext message) in /src/src/ Hyperledger.Aries/Agents/ AgentBase.cs:line 175 

at Hyperledger.Aries.Agents.AgentBa se.ProcessMessage(lAgentContext agentContext, MessageContext messageContext) in /src/src/ Hyperledger.ArieS/Agents/ AgentBase.cs:line 124 

at Hyperledger.Aries.Agents.Agent Base.ProcessAsync(lAgentContext context, MessageContext messageContext) in /src/src/ Hyperledger.Aries/Agents/ AgentBase.cs:line 112 

at Hyperledger.Aries.AspNetCore.A gentMiddleware.Invoke(HttpContext httpContext, lAgentProvider agentProvider) in /src/src/ Hyperledger.Aries.AspNetCore/ AgentMiddleware.cs:line 48 

at Microsoft.AspNetCore.Diagn ostics.DeveloperExceptionPage Middleware.|nvoke(HttpContext context)

On CLI:

web-agent-1_1  |       Request finished in 55.9901ms 200 text/html; charset=utf-8
web-agent-2_1  | info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
web-agent-2_1  |       Request starting HTTP/1.1 POST http://localhost:8000/ application/ssi-agent-wire 2405
web-agent-2_1  | fail: Hyperledger.Aries.Agents.AgentBase[0]
web-agent-2_1  |       Failed to un-pack message
web-agent-2_1  | fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
web-agent-2_1  |       An unhandled exception has occurred while executing the request.
web-agent-2_1  | Hyperledger.Aries.AriesFrameworkException: Failed to un-pack message
web-agent-2_1  |  ---> Hyperledger.Indy.WalletApi.WalletItemNotFoundException: No value with the specified key exists in the wallet from which it was requested.
web-agent-2_1  |    at Hyperledger.Aries.Utils.CryptoUtils.UnpackAsync(Wallet wallet, Byte[] message) in /src/src/Hyperledger.Aries/Utils/CryptoUtils.cs:line 66

Screenshots: https://www.dropbox.com/sh/tz9l9iv3wxbhncr/AADtdghXmK9PHlvaxDAVkeK4a?dl=0

kdenhartog commented 4 years ago

This is failing because the message contained in the QR code is not encrypted for a key contained in the wallet. That's what this is saying "letltemNotFoundException: No value with the specified key exists in the wallet from which it was requested".

naman20sharma commented 4 years ago

This is failing because the message contained in the QR code is not encrypted for a key contained in the wallet. That's what this is saying "letltemNotFoundException: No value with the specified key exists in the wallet from which it was requested".

Could you please elaborate the necessary steps to resolve this issue ?

x0axz commented 4 years ago

@naman20sharma actually I didn't face this error, but my teammate did.

Restart the Docker, Aries .Net Web Agent & OSMA. Open this directory in your computer https://github.com/hyperledger/aries-framework-dotnet/tree/master/samples/aspnetcore Open CLI and dotnet run Open http://localhost:5000/ in Browser.

I hope this helps :)

kdenhartog commented 4 years ago

This is failing because the message contained in the QR code is not encrypted for a key contained in the wallet. That's what this is saying "letltemNotFoundException: No value with the specified key exists in the wallet from which it was requested".

Could you please elaborate the necessary steps to resolve this issue ?

Should be just making sure the messages are encrypted to the right person. @tplooker or @sukalpomitra may be able to provide additional information on the specific solution if @x0axz solution doesn't resolve it.

naman20sharma commented 4 years ago

This is failing because the message contained in the QR code is not encrypted for a key contained in the wallet. That's what this is saying "letltemNotFoundException: No value with the specified key exists in the wallet from which it was requested".

Could you please elaborate the necessary steps to resolve this issue ?

Should be just making sure the messages are encrypted to the right person. @tplooker or @sukalpomitra may be able to provide additional information on the specific solution if @x0axz solution doesn't resolve it.

@x0axz Solution didn't work for me, I'm getting "Failed to accept invite!" message.

x0axz commented 4 years ago

@naman20sharma, dear, that's because of Ngrok. Follow these Steps: https://github.com/mattrglobal/osma#a-quick-demo

I hope this helps.

naman20sharma commented 4 years ago

@naman20sharma, dear, that's because of Ngrok. Follow these Steps: https://github.com/mattrglobal/osma#a-quick-demo

I hope this helps.

Hi, ngrok is working just fine, I'm scanning the ngrok forwarded url, Connection is established successfully, but now after sending 'Trust ping' from web agent to osma, I'm getting an exception, raised earlier https://user-images.githubusercontent.com/45759808/66181569-ebf5a680-e68e-11e9-8286-10af2d70c57c.png. Thanks for help.

kdenhartog commented 4 years ago

@naman20sharma, dear, that's because of Ngrok. Follow these Steps: https://github.com/mattrglobal/osma#a-quick-demo I hope this helps.

Hi, ngrok is working just fine, I'm scanning the ngrok forwarded url, Connection is established successfully, but now after sending 'Trust ping' from web agent to osma, I'm getting an exception, raised earlier https://user-images.githubusercontent.com/45759808/66181569-ebf5a680-e68e-11e9-8286-10af2d70c57c.png. Thanks for help.

Is there some way that you could turn on logging for this on both agents communicating so I can debug what keys are being used? I'm almost certain this is an issue about keys that are expected to be used are missing from wallets based on what you're describing

naman20sharma commented 4 years ago

@naman20sharma, dear, that's because of Ngrok. Follow these Steps: https://github.com/mattrglobal/osma#a-quick-demo I hope this helps.

Hi, ngrok is working just fine, I'm scanning the ngrok forwarded url, Connection is established successfully, but now after sending 'Trust ping' from web agent to osma, I'm getting an exception, raised earlier https://user-images.githubusercontent.com/45759808/66181569-ebf5a680-e68e-11e9-8286-10af2d70c57c.png. Thanks for help.

Is there some way that you could turn on logging for this on both agents communicating so I can debug what keys are being used? I'm almost certain this is an issue about keys that are expected to be used are missing from wallets based on what you're describing

Hi, This issue was raised earlier here https://github.com/mattrglobal/osma/issues/32, after sending 'Trust Ping' getting this exception, which keys are you talking about ? Should I share the keys (dids, verkey and other details of both the agents) with you ?

kdenhartog commented 4 years ago

@naman20sharma, dear, that's because of Ngrok. Follow these Steps: https://github.com/mattrglobal/osma#a-quick-demo I hope this helps.

Hi, ngrok is working just fine, I'm scanning the ngrok forwarded url, Connection is established successfully, but now after sending 'Trust ping' from web agent to osma, I'm getting an exception, raised earlier https://user-images.githubusercontent.com/45759808/66181569-ebf5a680-e68e-11e9-8286-10af2d70c57c.png. Thanks for help.

Is there some way that you could turn on logging for this on both agents communicating so I can debug what keys are being used? I'm almost certain this is an issue about keys that are expected to be used are missing from wallets based on what you're describing

Hi, This issue was raised earlier here #32, after sending 'Trust Ping' getting this exception, which keys are you talking about ? Should I share the keys (dids, verkey and other details of both the agents) with you ?

Yes, logs will be necessary for me to assist with any debugging.

x0axz commented 4 years ago

@naman20sharma Have a look at this file! https://github.com/mattrglobal/osma/blob/ea3bbdbc5d600d492d19058ee552b65698fd9e65/src/Osma.Mobile.App/ViewModels/Connections/AcceptInviteViewModel.cs#L24

naman20sharma commented 4 years ago

@x0axz @kdenhartog I looked in AcceptInviteViewModel.cs file, I put a breakpoint in CreateConnection(context, invite) method, I'm attaching the screenshots of the Locals, i hope it helps. Osma3 osma4

kdenhartog commented 4 years ago

I'm going to need actual logs, preferable from IndySDK to see what's going on. The error you're getting is being thrown by IndySDK while it's trying to decrypt the message passed in and throws an error at the IndySDK layer. This error is then passed back to the wrapper layer, which is caught in the agent-framework, and finally you're seeing the error you are.

I'm not sure if the unpacking is happening at the Mobile wallet layer or the web agent. It appears to be the web agent, but again I'll need logs to assist.

naman20sharma commented 4 years ago

@kdenhartog HI, I've got the logs from the terminals of web-agents here: https://pastebin.com/Q9wNfCBi and Of Osma App here https://pastebin.com/1bfQm5y0 If these aren't sufficient please specify from where I can access the logs required to debug this issue. Thank you !

kdenhartog commented 4 years ago

Hmm, I'm not sure. It doesn't appear to be an issue on the OSMA side because I can see on line 2821 that the pack message is successfully being created. It appears that the web agent is creating the connection, but is not storing the key in some way. Would you mind turning on debug mode for the web-agent and providing those logs?

naman20sharma commented 4 years ago

Hmm, I'm not sure. It doesn't appear to be an issue on the OSMA side because I can see on line 2821 that the pack message is successfully being created. It appears that the web agent is creating the connection, but is not storing the key in some way. Would you mind turning on debug mode for the web-agent and providing those logs? Hi, @kdenhartog https://pastebin.com/Q9wNfCBi contains web-agent logs, on line 390 it's failing to unpack message

kdenhartog commented 4 years ago

Yes, I saw that part, but what I'm curious about is what's happening with the keys when connections are being made such that the keys don't end up in the wallet. For example, having access to indy-sdk logs to better understand what's going on during line 343 and 344 would help me figure out what is happening with the keys.