Troubleshooting php_error_after_api Error Responses
Overview
When developing with Sugar, you may experience an API request returning a 500 error of php_error_after_api
. The request's response will be as follows:
{
"error": "php_error_after_api",
"error_message": "Your request failed to complete. A fatal error occurred. Check logs for more details."
}
This response indicates that there was a PHP error or warning in the application during the request.
Resolution
To identify the cause, you will need to set Sugar logging to "Error". Once logging has been set, trigger the action to reproduce the erroneous request. Now you will need to view your Sugar log. The log will have an entry similar to:
Fri Jan 20 17:41:31 2017 [21336][129a2843-b635-ce0a-dcbe-582f4e945378][ERROR] A PHP error occurred:
Warning: Error occurred in /path/file.php on line 278 [2017-01-20 17:41:30]
Now that the error has been identified, make any corrections needed in the indicated file and test your application to verify the issue has been resolved.