# Check webhook error causes and statistics
The Messaging API provides a feature to check error causes and statistics when sending webhooks. This is useful for understanding the status of sending webhooks when a webhook wasn't received due to a problem on the bot server, etc.
# Enable error statistics
The display of error statistics is disabled by default. To display error statistics, perform the following steps from the LINE Developers Console:
- Open the settings screen of the channel for which you want to display error statistics.
- Click the Messaging API tab.
- Turn on Use webhook.
- Turn on Error statistics aggregation.
The above will display error statistics. To view the statistics, go to the Statistics tab and select "Errors" from the drop-down.
Error statistics only show webhooks that were actually attempted to be sent. Error statistics don't include requests made to verify a webhook URL, regardless of whether they succeeded or failed.
# Check the reason for errors
Error statistics provide the reasons and details for errors. There are four types of reasons.
Reason | Summary |
---|---|
could_not_connect | The LINE Platform tried to send a webhook to the bot server, but couldn't successfully connect to the bot server. |
request_timeout | The LINE Platform sent a webhook to the bot server, but the bot server didn't return a response within one second. |
error_status_code | The LINE Platform sent a webhook to the bot server, but the bot server returned a response other than the HTTP status code in the 20x . |
unclassified | An unknown error occurred that can't be categorized above. |
The details for each reason are as follows.
- The reason is could_not_connect
- The reason is request_timeout
- The reason is error_status_code
- The reason is unclassified
# The reason is could_not_connect
If a webhook can't be successfully sent from the LINE Platform to the bot server, the reason will be could_not_connect
. The details in this case are as follows.
Detail | Summary |
---|---|
Connection failed | Failed to connect to bot server. |
Connection failed (received GOAWAY) | Connection refused when connecting to bot server. |
Connection failed (session closed) | Connection to the bot server was unexpectedly terminated. |
Connection timeout | Connection to the bot server didn't complete within a certain period of time. |
DNS Query timeout | Webhook URL name resolution was performed, but name resolution couldn't be completed within a certain period of time. |
Invalid URL syntax | An invalid webhook URL is specified (e.g., RFC violation). |
Session protocol negotiation failure | Connected to bot server, but protocol negotiation failed. |
TLS handshake failure | Connected to bot server, but TLS handshake failed. Check if the bot server supports SSL/TLS specification of the webhook source. |
Unknown host | The host specified in the Webhook URL couldn't be found. |
# The reason is request_timeout
If a webhook is sent from the LINE Platform to the bot server, but the response isn't received by the LINE Platform or the sending fails midway, the reason will be request_timeout
. The details in this case are as follows. Note that the webhook may have been successfully received by the bot server.
Detail | Summary |
---|---|
Request timeout | Webhook was sent to the bot server, but no response was returned within a certain period of time. |
# The reason is error_status_code
If the reason is error_status_code
, the details will contain the HTTP status code.
# The reason is unclassified
If an unclassified error occurs, the reason is unclassified
. The details in this case are as follows.
Detail | Summary |
---|---|
Session closed unexpectedly | A webhook was sent to the bot server, but the connection was unexpectedly closed. |
Stream closed unexpectedly | A webhook was sent to the bot server, but the stream was unexpectedly closed. |
Unclassified webhook dispatch error | An unclassifiable and unexpected error occurred. |