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

[Question] Observe errors from agent #1700

Open
icc-romeu opened this issue Jan 18, 2024 · 4 comments
Open

[Question] Observe errors from agent #1700

icc-romeu opened this issue Jan 18, 2024 · 4 comments

Comments

@icc-romeu
Copy link

Hi,

I have been through the package and I did not find this. Is there an event I can listen to get the errors in processing messages/connections/proofs... Something like:

agent.events.on(AgentEventTypes.Errors, async (error) => ... )

It would be nice to give user some feedback of what happened, but I cannot find anything...

@TimoGlastra
Copy link
Contributor

We have an AgentEventProcessed event which for a long time I'd like to extend to also include error states that occurred during processing.

So it will always emit the event for every received message, but can also contains errors etc..

https://github.com/openwallet-foundation/agent-framework-javascript/blob/ee34fe71780a0787db96e28575eeedce3b4704bd/packages/core/src/agent/Dispatcher.ts#L19

Would that solve your problem?

@icc-romeu
Copy link
Author

Let me check... If I can differentiate errors, yes. 👍

@icc-romeu
Copy link
Author

Hi again, just tested and no luck. 😞

Used this to check for events:

agent.events.on<AgentMessageProcessedEvent>(AgentEventTypes.AgentMessageProcessed, event => {
        console.log('[AgentMessageProcessed] ', event);
});

And forced an error, but... the event did not fire. What I saw came from the agent logger. So I assume that other events need to be captured in order to be able to observe processing errors.

 DEBUG  DEBUG: Agent received message
 DEBUG  DEBUG: Processing presentation request with id 1da94639-773a-4f60-86e1-4322edc84760
 LOG  isConnected => {"outOfBandRecord": {"_tags": [Object], "autoAcceptConnection": true, "createdAt": "2024-01-19T08:53:33.303Z", "id": "fddb8c9a-4829-43e1-a788-19961ae1c5f0", "metadata": [Object], "outOfBandInvitation": [Object], "reusable": false, "role": "receiver", "state": "prepare-response", "updatedAt": "2024-01-19T08:53:33.388Z"}}
 ERROR  ERROR: Error handling message with type https://didcomm.org/present-proof/1.0/request-presentation {
  "message": {
    "@type": "https://didcomm.org/present-proof/1.0/request-presentation",
    "comment": null,
    "request_presentations~attach": [
      {
        "@id": "libindy-request-presentation-0",
        "mime-type": "application/json",
        "data": {
          "base64": "whatever"
        }
      }
    ],
    "@id": "1da94639-773a-4f60-86e1-4322edc84760"
  },
  "error": {
    "name": "RecordNotFoundError",
    "message": "DidCommMessageRecord: No record found for given query '{\"associatedRecordId\":\"a9adb16d-b7b1-4587-9ef4-56373dc889fe\",\"messageName\":\"propose-presentation\",\"protocolName\":\"present-proof\",\"protocolMajorVersion\":\"1\"}'",
    "stack": "RecordNotFoundError: DidCommMessageRecord: No record found for given query '{\"associatedRecordId\":\"a9adb16d-b7b1-4587-9ef4-56373dc889fe\",\"messageName\":\"propose-presentation\",\"protocolName\":\"present-proof\",\"protocolMajorVersion\":\"1\"}'\n    at ?anon_0_ (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:185447:87)\n    at next (native)\n    at asyncGeneratorStep (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:28327:26)\n    at _next (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:28346:29)\n    at tryCallOne (/root/react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/Release/1i515cg5/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:53:16)\n    at anonymous (/root/react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/Release/1i515cg5/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:139:27)\n    at apply (native)\n    at anonymous (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:34958:26)\n    at _callTimer (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:34837:17)\n    at _callReactNativeMicrotasksPass (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:34882:17)\n    at callReactNativeMicrotasks (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:35088:44)\n    at __callReactNativeMicrotasks (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:3256:46)\n    at anonymous (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:3030:45)\n    at __guard (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:3229:15)\n    at flushedQueue (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:3029:21)"
  }
}
 ERROR  ERROR: Failed to process message {
  "error": {
    "name": "RecordNotFoundError",
    "message": "DidCommMessageRecord: No record found for given query '{\"associatedRecordId\":\"a9adb16d-b7b1-4587-9ef4-56373dc889fe\",\"messageName\":\"propose-presentation\",\"protocolName\":\"present-proof\",\"protocolMajorVersion\":\"1\"}'",
    "stack": "RecordNotFoundError: DidCommMessageRecord: No record found for given query '{\"associatedRecordId\":\"a9adb16d-b7b1-4587-9ef4-56373dc889fe\",\"messageName\":\"propose-presentation\",\"protocolName\":\"present-proof\",\"protocolMajorVersion\":\"1\"}'\n    at ?anon_0_ (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:185447:87)\n    at next (native)\n    at asyncGeneratorStep (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:28327:26)\n    at _next (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:28346:29)\n    at tryCallOne (/root/react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/Release/1i515cg5/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:53:16)\n    at anonymous (/root/react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/Release/1i515cg5/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:139:27)\n    at apply (native)\n    at anonymous (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:34958:26)\n    at _callTimer (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:34837:17)\n    at _callReactNativeMicrotasksPass (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:34882:17)\n    at callReactNativeMicrotasks (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:35088:44)\n    at __callReactNativeMicrotasks (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:3256:46)\n    at anonymous (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:3030:45)\n    at __guard (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:3229:15)\n    at flushedQueue (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=org.unicc.undigitalid&modulesOnly=false&runModule=true:3029:21)"
  }
}

@TimoGlastra
Copy link
Contributor

Ah i meant as a possible solution to your problem that we could implement.

It's not working like that at the moment. Sorry for the confusion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants