After you write code for a function, you must debug the function to verify whether
the code is correct. This topic describes how to debug a function.
Procedure
You can refer to the following steps to debug a function, and adjust and apply them
as required:
- Use a browser to trigger Function B.
An authentication error is returned because the IP address of your computer is not
added to the whitelist of Function B.
{
# Protected data is not returned due to the authentication error.
"protected_data": "",
"white_list": [
"127.0.X.X",
"X.X.X.X"
],
"authorized": false,
# The IP address of the visitor is returned.
"remote_ip": "X.X.X.X"
}
- Use a browser to trigger Function A and obtain the results of invoking Function B
by Function A with and without using the proxy.
{
"query_with_proxy_result": {
"secret_data": "Alibaba",
"success": true,
"data_service_raw_data": {
"remote_ip": "X.X.X.X",
"white_list": [
"127.0.X.X",
"X.X.X.X"
],
"authorized": true,
"protected_data": "Alibaba"
}
},
"query_without_proxy_result": {
"secret_data": "",
"success": false,
"data_service_raw_data": {
"remote_ip": "XX.XX.XX.XX",
"white_list": [
"127.0.X.X",
"X.X.X.X"
],
"authorized": false,
"protected_data": ""
}
}
}
If you obtain the protected data by using the proxy, the function code is correctly
written.