zoneminder
zoneminder copied to clipboard
Targeting monitor.json via API returns 500 Internal Server Error
Describe Your Environment
- Version of ZoneMinder: v1.36.5
- How you installed ZoneMinder: RPMFusion
- Full name and version of OS: CentOS Linux release 8.2.2004 (Core)- Browser name and version (if this is an issue with the web interface)
If the issue concerns a camera It doesn't
Describe the bug When targeting monitor.json via API, it will return 500 Internal Server Error
To Reproduce Using following Python code:
import requests
req = requests.post("https://domain.com/zm/api/host/login.json", data={'user': 'user', 'pass': 'pass'})
token_url_suffix = f"?token={req.json()['access_token']}"
req = requests.request("get", "https://domain.com/zm/api/monitors.json" + token_url_suffix, data=None, cookies=None)
req.ok
req.reason
req.status_code
req.ok Returns: "False" req.reason Returns: "Internal Server Error" req.status_code Returns: "500"
Expected behavior It should return the list of monitors.
Debug Logs vhost-apache.log, it can be seen that monitors.json returns 500 but others, like "host/getVersion.json" returns OK (200)
192.168.0.100 - - [18/Aug/2021:21:41:01 +0200] "GET /zm/api/monitors.json?token=xxx.yyy.zzz-mL3dMcBMW3wlu_EupM HTTP/1.1" 500 498 "-" "python-requests/2.21.0"
192.168.0.100 - - [18/Aug/2021:21:43:19 +0200] "GET /zm/api/monitors.json?token=xxx.yyy.zzz-mL3dMcBMW3wlu_EupM HTTP/1.1" 500 498 "-" "python-requests/2.21.0"
192.168.0.100 - - [18/Aug/2021:21:45:45 +0200] "GET /zm/api/getVersion.json?token=xxx.yyy.zzz-mL3dMcBMW3wlu_EupM HTTP/1.1" 404 279 "-" "python-requests/2.21.0"
192.168.0.100 - - [18/Aug/2021:21:45:59 +0200] "GET /zm/api/host/getVersion.json?token=xxx.yyy.zzz-mL3dMcBMW3wlu_EupM HTTP/1.1" 200 39 "-" "python-requests/2.21.0"
Zoneminder cake_error.log:
Request URL: /zm/api/monitors.json?token=xxx.yyy.zzz-mL3dMcBMW3wlu_EupM
Stack Trace:
#0 /usr/share/zoneminder/www/api/lib/Cake/Model/Model.php(3686): Model->setSource('Event_Summaries')
#1 /usr/share/zoneminder/www/api/lib/Cake/Model/Model.php(1394): Model->getDataSource()
#2 /usr/share/zoneminder/www/api/lib/Cake/Model/Datasource/DboSource.php(2663): Model->schema()
#3 /usr/share/zoneminder/www/api/lib/Cake/Model/Datasource/DboSource.php(1870): DboSource->fields(Object(Event_Summary), 'Event_Summary', '')
#4 /usr/share/zoneminder/www/api/lib/Cake/Model/Datasource/DboSource.php(1213): DboSource->generateAssociationQuery(Object(Monitor), Object(Event_Summary), 'hasOne', 'Event_Summary', Array, Array, false)
#5 /usr/share/zoneminder/www/api/lib/Cake/Model/Model.php(3053): DboSource->read(Object(Monitor), Array)
#6 /usr/share/zoneminder/www/api/lib/Cake/Model/Model.php(3025): Model->_readDataSource('all', Array)
#7 /usr/share/zoneminder/www/api/app/Controller/MonitorsController.php(67): Model->find('all', Array)
#8 [internal function]: MonitorsController->index()
#9 /usr/share/zoneminder/www/api/lib/Cake/Controller/Controller.php(499): ReflectionMethod->invokeArgs(Object(MonitorsController), Array)
#10 /usr/share/zoneminder/www/api/app/Plugin/Crud/Lib/CrudControllerTrait.php(31): Controller->invokeAction(Object(CakeRequest))
#11 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(193): AppController->invokeAction(Object(CakeRequest))
#12 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(MonitorsController), Object(CakeRequest))
#13 /usr/share/zoneminder/www/api/app/webroot/index.php(117): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#14 {main}
2021-08-18 21:45:45 Error: [MissingControllerException] Controller class GetVersionController could not be found.
Exception Attributes: array (
'class' => 'GetVersionController',
'plugin' => NULL,
)
Request URL: /zm/api/getVersion.json?token=xxx.yyy.zzz-mL3dMcBMW3wlu_EupM
Stack Trace:
#0 /usr/share/zoneminder/www/api/app/webroot/index.php(117): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#1 {main}
Other notes PHP Version 7.2.24
...forget about it. I've done all the damned troubleshooting steps but all i had to do is to restart the freakin' php-fpm... Which i thought of it after posting here and on zoneminder github...
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.