'Dialogflow - Firestore - Webhook call failed. Error: UNAVAILABLE, State: URL_UNREACHABLE, Reason: UNREACHABLE_5xx, HTTP status code: 500

I am trying for a fulfillment in Dialogflow using Firebase. There is data in Firestore and the intent is expected to retrieve the results based on the given parameter in the related intent. The intent is enables for webhook call. But the intent returns with one of the predefined responses.

I always get the error "message": "Webhook call failed. Error: UNAVAILABLE, State: URL_UNREACHABLE, Reason: UNREACHABLE_5xx, HTTP status code: 500."

Following is the Diagnostic Info from the test console

{
  "responseId": "e27d24ba-cb14-4170-a7d8-a97314aee001-cad07fe1",
  "queryResult": {
    "queryText": "novaluron",
    "parameters": {
      "chemical": "novaluron"
    },
    "allRequiredParamsPresent": true,
    "fulfillmentText": "This molecule is useful",
    "fulfillmentMessages": [
      {
        "text": {
          "text": [
            "This molecule is useful"
          ]
        }
      }
    ],
    "intent": {
      "name": "projects/ppcagent-ahe9/agent/intents/6d9df198-9517-4d61-a480-87c158accdc5",
      "displayName": "ChemicalDetails"
    },
    "intentDetectionConfidence": 0.3,
    "diagnosticInfo": {
      "webhook_latency_ms": 106
    },
    "languageCode": "en",
    "sentimentAnalysisResult": {
      "queryTextSentiment": {
        "score": 0.3,
        "magnitude": 0.3
      }
    }
  },
  "webhookStatus": {
    "code": 14,
    "message": "Webhook call failed. Error: UNAVAILABLE, State: URL_UNREACHABLE, Reason: UNREACHABLE_5xx, HTTP status code: 500."
  }
}

Any help will be greatly appreciated.



Solution 1:[1]

This error could be due to different reasons, you can check these points:

Use of insecure connection. You need to use HTTP requests. The service must use HTTPS and the URL must be publicly accessible in order for the fulfillment to function. DialogFlow does not support self-signed SSL certs. For information on SSL setup:

Permission errors. Server files and folders need correct permissions and ownerships set in order to work properly. If Websites request files for which the server has no access then it will lead to an error.You can see more documentation about permission.

Bad scripting. You need to check the code and check if there are any errors and modify them.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Raul Saucedo