Troubleshooting
When errors/exceptions occur in the system, the API Microgateway throws error responses to the client by default. The following sections explain about the different ways of troubleshooting common problems that might occur while you use the Microgateway.
Common exceptions and solutions
The table below shows the common exceptions that might occur when you are trying to use the API Microgateway, and how to fix them. These exceptions can happen due to misconfigurations.
Runtime errors
Error log | Possible cause | Resolution |
|---|---|---|
| The API Manager node (Publisher) is down when running the setup command in the Microgateway. | Verify the connectivity between the Microgateway and the API manager node. |
| Connection to the backend is refused. | Check the connection to the backend. |
| The name of the docker images should be in lower case. When building the project with docker annotations, the docker image name is retrieved from the API name and version. If the API name contains a capital letter, then the docker image n ame would reflect that, resuling in this error. | When building the API microgateway project, provide a simple letter name for the docker image in the [docker]
[docker.dockerConfig]
enable = true
name = "hello_world"
|
| The Microgateway could not connect to the Key Manager for OAuth2 key validation. | Check the connection between the Microgateway and the Key Manager. |
| SSL hostname verification has failed in the key validation call. | The You need to add the public certificate of the Key Manager to the Microgateway truststore. Also, make sure that you change the |
| JWT signature verification has failed. | Verify the following:
|
Toolkit errors
Error log | Possible cause | Resolution |
|---|---|---|
| A connection to the backend could not be established because the network is unavailable. | Verify the network stability. |
| This is due to an issue in the Service template. |
|
| You get this error when you re-run the | Carry out one of the following actions to overcome this error.
|
Runtime error responses
Error code | Error response | Possible reasons |
|---|---|---|
| {
"fault": {
"code": "101503",
"message": "Runtime Error",
"description": "Error connecting to the back end"
}
}
|
|
| {
"fault": {
"code": "101504",
"message": "Runtime Error",
"description": "Connection timed out"
}
}
|
|
| {
"fault": {
"code": 900900,
"message": "Unclassified Authentication Failure",
"description": "Unclassified Authentication Failure"
}
}
|
|
Runtime error codes
Given below are some WSO2 API Microgateway specific error codes and their meanings.
Error code | Possible reason |
|---|---|
| The production/sandbox key offered by the requested endpoint is not specified. |
| API-M authentication related error. |
| Invalid access token. |
| Missing credentials. |
| Access token expired. |
| Access token inactive. |
| Incorrect access token type provided. |
| No matching resource found in the API for the given request. |
| The requested API is temporarily blocked. |
| Resource forbidden. |
| The subscription to the API is inactive. |
| The access token does not allow you to access the requested resource. |
| Application level throttled out. |
| Subscription level throttled out. |
| An internal error occurred in the Microgateway. |
| An internal error occurred in the Microgateway, since a subscription or application throttle policy is not deployed. This might be due to adding a throttle policy to API-M and not regenerating the Microgateway. |
Adding Debug Logs
Micro gateway uses two types of logs to track realtime internal and external activities. Separate log files are created for each of those log types in the <MGW_RUNTIME_HOME>/repository/logs directory. Following illustrates the log types supported by the MGW and how those logs can be configured.
How to enable debug log
If we want to log any information that helps us identify what went wrong we can get information by enable DEBUG level. Ther are two ways to enable debug log.
Method 1. We can set in the request command.
Response caching
sh gateway <path-to-MGW-executable-jar-file> --b7a.log.level=DEBUG
Method 2. We can set in the micro-gw.conf file which is located in the <MGW-RUNTIME-HOME>/conf directory.
Response caching
[b7a.log]
level = "DEBUG"
How to enable HTTP trace log
If we want to monitor the HTTP message flow through API Gateway and track the request headers, request payloads, response headers, response payloads etc of incoming and outgoing http traffic we can get information by enable HTTP trace log .
Method 1. We can set in the request command.
sh gateway <path-to-MGW-executable-jar-file> --b7a.http.tracelog.console=true
Method 2. We can set in the micro-gw.conf file which is located in the <MGW-RUNTIME-HOME>/conf directory.
[b7a.http]
[b7a.http.tracelog]
console = true