Symptoms
I get a HTTP 500 error when trying to perform a CRUD operation on a resource in my package, how do I find out the cause?
POST http://sandbox.apsdemo.org:8080/aps/2/resources/7cbcc96a-5781-4c4e-a2c7-5d29601439cb/users/ 500
RequestError: Unable to load /aps/2/resources/7cbcc96a-5781-4c4e-a2c7-5d29601439cb/users/ status: 0
Resolution
- Enable 'APS development mode' (see this KB)
Tail main Operations Automation log during this operation:
tail -fn0 /var/log/poa.debug.log > error
Search the resulting log for failing request to endpoint, it would look like this:
Dec 2 13:13:21 sandbox : DBG [SYSTEM 1:1647:addfeb70 SAAS]: [txn:1007778 APSC] curl -D- -X POST -H 'APS-Controller-URI: https://10.10.2.224:6308/' -H 'APS-Instance-ID: c2a16301-4e00-4f62-8ff9-ce78bd851e49' -H 'APS-Transaction-ID: d5733207-15ed-4ec1-88c9-d5c63cf537ee' -H 'Accept: text/html' -H 'Host: endpoint.sandbox.apsdemo.org' -d @/tmp/bcaf8ca8-e79f-40dc-a6fb-b3e3dd899d7e.20131202T131321.540978 http://endpoint.sandbox.apsdemo.org/package/users Dec 2 13:13:21 sandbox : INF [SYSTEM 1:1647:addfeb70 SAAS]: [txn:1007778 APSC] REST method returns 500 Internal Server Error
Execute this curl request while monitoring webservers error log on endpoint server (in this case Apache):
[root@sandbox ~]# curl -D- -X POST -H 'APS-Controller-URI: https://10.10.2.224:6308/' -H 'APS-Instance-ID: c2a16301-4e00-4f62-8ff9-ce78bd851e49' -H 'APS-Transaction-ID: d5733207-15ed-4ec1-88c9-d5c63cf537ee' -H 'Accept: text/html' -H 'Host: endpoint.sandbox.apsdemo.org' -d @/tmp/bcaf8ca8-e79f-40dc-a6fb-b3e3dd899d7e.20131202T131321.540978 http://endpoint.sandbox.apsdemo.org/package/users HTTP/1.0 500 Internal Server Error Date: Mon, 02 Dec 2013 09:20:34 GMT Server: Apache/2.2.15 (CentOS) X-Powered-By: PHP/5.3.3 Content-Length: 0 Connection: close Content-Type: text/html; charset=UTF-8
Error log of webserver on endpoint will show details of the problem:
[root@endpoint ~]# tail -fn0 /var/log/httpd/error_log
[2013/12/02 09:25:35] DEBUG TypeLibrary: Can't found class 'http://aps-standard.org/types/core/resource/1.0', loading from /usr/share/aps/php/aps/2/types/org/standard/aps/types/core/resource/Resource.php
[2013/12/02 09:25:35] DEBUG Incoming Application API request: POST package/users
[Mon Dec 02 13:25:35 2013] [error] [client 10.10.2.224] PHP Fatal error: Class 'Logger' not found in /var/www/html/package/users.php on line 88
Note: TypeLibrary
message can be ignored, this is just a debug information from aps-php-runtime.
Note: /var/log/httpd/error_log
may become /var/log/httpd/ssl_error_log
depending on the way endpoint is contacted over HTTP.