Anders_K
Anders_K

Reputation: 992

Where to view watson assistant error logs

A webhook call fails, how do I see the detailed logs?

enter image description here

Upvotes: 0

Views: 549

Answers (1)

DSeager
DSeager

Reputation: 227

The testing webhooks page describes that the errors are put in output.webhook_error.<result_variable>. For example if your result variable is webhook_result_1 then the output is in output.webhook_error.webhook_result_1.

As described in the documentation, if an error happens then in the "Assistant responds" section of the dialog node editor, the "If assistant recognizes" anything_else should be used, so you can put in there The callout generated this error: <? output.webhook_error.webhook_result_1 ?>..

This will show more information. For example if I configure an API to throw an Error, I will get back:

The callout generated this error: {"response_code":400,"message":"Webhook call was not successful. Response code is [400].","response_body":{"code":"cff11d18150e8018d5e304ac3fc35c94","error":"There was an error processing your request."},"content_type":"application/json"}.

If this error happens when the Bot is being used live, then in the logs the webhook response body will be captured. If you use the Try It Out panel in the UI then the logs are not captured.

In the Assistant UI for the Skill in the Analytics tab the conversation is shown. In the "User conversations" part of the UI the text of the conversation is captured, but you will only see the webhooks error if you add output as described above.

The API can be used to fetch logs for a workspace or skill which include the webhook error details. See List Log Events in a Workspace. If you are using a Skill then you can find out the URL to use from the Assistant UI. On the Skills list page, on the particular skill click the ... menu and select View API Details. The Legacy v1 workspace URL: shows the workspace ID to use.

For example if the Legacy v1 workspace URL: is https://gateway.watsonplatform.net/assistant/api/v1/workspaces/ce13f844-c3a7-4f36-97c6-a0ac704024a6/message the URL to use to fetch logs is https://gateway.watsonplatform.net/assistant/api/v1/workspaces/ce13f844-c3a7-4f36-97c6-a0ac704024a6/logs?version=2020-04-01

In the workspace log there will be the details of the user conversation where a webhook error happened in webhook_error:

"output": {
  "generic": [
      {
          "response_type": "text",
          "text": ""
      },
      {
          "response_type": "text",
          "text": "The callout generated this error: {\"response_code\":400,\"message\":\"Webhook call was not successful. Response code is [400].\",\"response_body\":{\"code\":\"cff11d18150e8018d5e304ac3fc35c94\",\"error\":\"There was an error processing your request.\"},\"content_type\":\"application/json\"}."
      },
      {
          "response_type": "text",
          "text": "Customer email is <? context.webhook_result_1.message ?>."
      }
  ],
  "text": [
      "",
      "The callout generated this error: {\"response_code\":400,\"message\":\"Webhook call was not successful. Response code is [400].\",\"response_body\":{\"code\":\"cff11d18150e8018d5e304ac3fc35c94\",\"error\":\"There was an error processing your request.\"},\"content_type\":\"application/json\"}.",
      "Customer email is <? context.webhook_result_1.message ?>."
  ],
  "nodes_visited": [
      "slot_2_1520179906877",
      "handler_3_1520179906877",
      "node_1_1520179877410",
      "node_9_1530805081298",
      "response_5_1604940050659",
      "node_7_1520180645829"
  ],
  "webhook_error": {
      "webhook_result_1": {
          "response_code": 400,
          "message": "Webhook call was not successful. Response code is [400].",
          "response_body": {
              "code": "cff11d18150e8018d5e304ac3fc35c94",
              "error": "There was an error processing your request."
          },
          "content_type": "application/json"
      }
  },
  "nodes_visited_details": [

Upvotes: 2

Related Questions