After upgrade to 1.36.34 zmeventnotification fails to log in

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
zmevtuser
Posts: 10
Joined: Mon Jun 26, 2023 9:38 pm

After upgrade to 1.36.34 zmeventnotification fails to log in

Post by zmevtuser »

System: Debian 10. After upgrade to 1.36.34 test run of notification service shows the following:

Code: Select all

sudo -u www-data zmeventnotification/bin/zm_detect.py -l --config /etc/zm/objectconfig.ini  --eventid 1474046 --monitorid 2 --debug
10/07/24 23:31:02 zmesdetect_m2[9690] INF ZMLog.py:292 [Setting up signal handler for logs]

10/07/24 23:31:02 zmesdetect_m2[9690] INF ZMLog.py:301 [Switching global logger to ZMLog]

10/07/24 23:31:03 zmesdetect_m2[9690] INF zm_detect.py:282 [---------| app:6.1.28, pyzm:0.3.63, ES:6.1.28
 , OpenCV:4.10.0-dev|------------]

10/07/24 23:31:03 zmesdetect_m2[9690] INF utils.py:404 [Reading config from: /etc/zm/objectconfig.ini]

10/07/24 23:31:03 zmesdetect_m2[9690] INF utils.py:409 [Reading secrets from: /etc/zm/secrets.ini]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG2 utils.py:381 [Secret token found in config: !ZM_PORTAL]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG2 utils.py:381 [Secret token found in config: !ZM_USER]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG2 utils.py:381 [Secret token found in config: !ZM_PASSWORD]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG2 utils.py:381 [Secret token found in config: !ZM_API_PORTAL]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG2 utils.py:381 [Secret token found in config: !ML_USER]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG2 utils.py:381 [Secret token found in config: !ML_PASSWORD]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG2 utils.py:381 [Secret token found in config: !PLATEREC_ALPR_KEY]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG1 utils.py:444 [allowing self-signed certs to work...]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG2 utils.py:454 [Now checking for monitor overrides]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG2 utils.py:174 [import_zm_zones: match_reason=False and reason=None]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG2 utils.py:177 [Getting ZM zones using http://localhost/zm/api/zones/forMonitor/2.json?username=xxx&password=yyy&user=xxx&pass=yyy]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG2 utils.py:227 [importing zoneminder polygon: xxxx [659,356 1134,158 1124,540 880,719]]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG2 utils.py:227 [importing zoneminder polygon: walk [800,762 1135,523 1918,825 1297,1079]]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG2 utils.py:227 [importing zoneminder polygon: outside [0,0 904,1 1252,188 0,935]]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG3 utils.py:521 [Finally, doing parameter substitution]

10/07/24 23:31:03 zmesdetect_m2[9690] INF zm_detect.py:307 [Importing local classes for Object/Face]

10/07/24 23:31:03 zmesdetect_m2[9690] INF zm_detect.py:332 [Connecting with ZM APIs]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG2 api.py:69 [API SSL certificate check has been disbled]

10/07/24 23:31:03 zmesdetect_m2[9690] DBG1 api.py:173 [using username/password for login]

10/07/24 23:31:03 zmesdetect_m2[9690] ERR api.py:223 [Got API login error: 500 Server Error: Internal Server Error for url: http://localhost/zm/api/host/login.json]

10/07/24 23:31:03 zmesdetect_m2[9690] FAT zm_detect.py:564 [Unrecoverable error:500 Server Error: Internal Server Error for url: http://localhost/zm/api/host/login.json Traceback:Traceback (most recent call last):
  File "/mnt/video/zmeventnotification/bin/zm_detect.py", line 559, in <module>
    main_handler()
  File "/mnt/video/zmeventnotification/bin/zm_detect.py", line 333, in main_handler
    zmapi = zmapi.ZMApi(options=api_options)
  File "/usr/local/lib/python3.7/dist-packages/pyzm-0.3.63-py3.7.egg/pyzm/api.py", line 76, in __init__
    self._login()
  File "/usr/local/lib/python3.7/dist-packages/pyzm-0.3.63-py3.7.egg/pyzm/api.py", line 225, in _login
    raise err
  File "/usr/local/lib/python3.7/dist-packages/pyzm-0.3.63-py3.7.egg/pyzm/api.py", line 195, in _login
    r.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http://localhost/zm/api/host/login.json
]
corresponding contents of /var/log/zm/error.log:

Code: Select all

2024-10-07 23:31:03 Error: [MissingViewException] View file "Host/json/login.ctp" is missing.
Exception Attributes: array (
  'file' => 'Host/json/login.ctp',
)
Request URL: /zm/api/host/login.json?p=%2Fhost%2Flogin.json
Stack Trace:
#0 /usr/share/zoneminder/www/api/lib/Cake/View/JsonView.php(107): View->_getViewFileName('Host/json/login')
#1 /usr/share/zoneminder/www/api/lib/Cake/Controller/Controller.php(968): JsonView->render(NULL, NULL)
#2 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(200): Controller->render()
#3 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(HostController), Object(CakeRequest))
#4 /usr/share/zoneminder/www/api/app/webroot/index.php(117): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#5 {main}
Would be grateful for any clues or suggestions
zmevtuser
Posts: 10
Joined: Mon Jun 26, 2023 9:38 pm

Re: After upgrade to 1.36.34 zmeventnotification fails to log in

Post by zmevtuser »

To moderators: if this post relates to zmeventnotification more than to zoneminder, please consider moving this topic to the relevant section
User avatar
burger
Posts: 437
Joined: Mon May 11, 2020 4:32 pm

Re: After upgrade to 1.36.34 zmeventnotification fails to log in

Post by burger »

What happens when you test the API outside of ZMES? See: https://wiki.zoneminder.com/API for instructions.

This error looks like it's with CakePHP, and the controller is not that complicated if you dig into it. I wrote something about it here: https://wiki.zoneminder.com/API#Finding ... in_the_API Is the https://github.com/ZoneMinder/zoneminde ... roller.php file there? Did the upgrade get corrupted somehow? I'd look at the filesystem, then enable debugging in CakePHP.

If you have a working environment, you can compare the differences between the debug logs of CakePHP from one to the other. That should reveal something.
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
zmevtuser
Posts: 10
Joined: Mon Jun 26, 2023 9:38 pm

Re: After upgrade to 1.36.34 zmeventnotification fails to log in

Post by zmevtuser »

Thank you for the reply, http://localhost/zm/api/host/getVersion.json returns with successful response, however http://localhost/zm/api/host/login.json produces an error:

Code: Select all

{"success":false,"data":{"name":"An Internal Error Has Occurred.","message":"An Internal Error Has Occurred.","url":"\/zm\/api\/host\/login.json?p=%2Fhost%2Flogin.json","exception":{"class":"MissingViewException","code":500,"message":"View file \"Host\/json\/login.ctp\" is missing."}}}
Checked package integrity (dpkg -V zoneminder), found no issues except changed config files. Error message states that login.ctp is missing and there is indeed no such file anywhere, but I could not find it in the DEB package either. Previous versions also do not have it.
User avatar
iconnor
Posts: 3227
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: After upgrade to 1.36.34 zmeventnotification fails to log in

Post by iconnor »

This generally happens when you have auth turned off. Is fixed in 1.36.35 proposed.
zmevtuser
Posts: 10
Joined: Mon Jun 26, 2023 9:38 pm

Re: After upgrade to 1.36.34 zmeventnotification fails to log in

Post by zmevtuser »

Thank you, I turned on authentication and script works.
Post Reply