Unrecoverable error:Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersion.j

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
Post Reply
ArloEardley
Posts: 2
Joined: Sat Jul 02, 2022 10:32 pm

Unrecoverable error:Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersion.j

Post by ArloEardley »

HI guys

I am most of the way through my setup of the event server bur for the life of me I can't figure out where the zm_detect.py is trying to pull the host url from. In the code (zmpy scripts) it appears to be ml_gateway or apiurl I think. Some config somewhere is missing and it doesn't seem to pull through the https://someip/zm/api into the config when I try to test if the object detection is working on an event from zone minder. Anyone know what config I am missing?
Attachments
logs.PNG
logs.PNG (280.77 KiB) Viewed 10462 times
tsp84
Posts: 227
Joined: Thu Dec 24, 2020 4:04 am

Re: Unrecoverable error:Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersi

Post by tsp84 »

Objectconfig.ini

'api_portal' and 'portal' options which are set as secrets by default (secrets are configured as !<secret name>)

So either remove the default options of
portal=!ZM_PORTAL
api_portal=!ZM_API_PORTAL

and hardcore the url there or you can leave the secret token there and edit secrets.ini and to set the value of the secret tokens.

ZM_PORTAL=<zm portal url>
ZM_API_PORTAL=<zm API portal>
ArloEardley
Posts: 2
Joined: Sat Jul 02, 2022 10:32 pm

Re: Unrecoverable error:Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersi

Post by ArloEardley »

I am afraid this is not it. Is it perhaps an apache2 problem? Here are my secrets and objectconfig.ini to reference.
Attachments
objectconfig.PNG
objectconfig.PNG (852.07 KiB) Viewed 10431 times
secrets.PNG
secrets.PNG (188.71 KiB) Viewed 10431 times
sp00ge
Posts: 5
Joined: Thu Dec 16, 2010 9:32 am

Re: Unrecoverable error:Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersi

Post by sp00ge »

Sorry for bumping an old thread up, but did you ever resolve this issue ?

Like yourself I am getting the following error running zm_detect.py

Code: Select all

04/16/23 16:20:40 zmesdetect_m4[4383] FAT zm_detect.py:561 [Unrecoverable error:Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersion.json? Traceback:Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 556, in <module>
    main_handler()
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 335, in main_handler
    zmapi = zmapi.ZMApi(options=api_options)
  File "/usr/local/lib/python3.10/dist-packages/pyzm/api.py", line 76, in __init__
    self._login()
  File "/usr/local/lib/python3.10/dist-packages/pyzm/api.py", line 185, in _login
    r = self.session.post(url, data=data)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 528, in request
    prep = self.prepare_request(req)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 456, in prepare_request
    p.prepare(
  File "/usr/lib/python3/dist-packages/requests/models.py", line 316, in prepare
    self.prepare_url(url, params)
  File "/usr/lib/python3/dist-packages/requests/models.py", line 390, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersion.json?
]
I have double checked that I have changed the secrets.ini file to include my URL's and can confirm that zm_detect is reading from the config files.

04/16/23 16:20:39 zmesdetect_m4[4383] INF utils.py:405 [Reading config from: /etc/zm/zmeventnotification.ini]
04/16/23 16:20:39 zmesdetect_m4[4383] INF utils.py:410 [Reading secrets from: /etc/zm/secrets.ini]

But now at a loss to where to troubleshoot.

Thanks
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Unrecoverable error:Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersi

Post by Magic919 »

Does your ZM API work when you test it?
-
sp00ge
Posts: 5
Joined: Thu Dec 16, 2010 9:32 am

Re: Unrecoverable error:Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersi

Post by sp00ge »

Magic919 wrote: Sun Apr 16, 2023 5:54 pm Does your ZM API work when you test it?
Yes,

Code: Select all

curl  -X POST -d "user=****&pass=********" http://localhost/zm/api/host/getVersion.json
{"version":"1.36.33","apiversion":"2.0"}
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Unrecoverable error:Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersi

Post by Magic919 »

Ok. So there's something in your ZMES that is failing to pass on the http/https part of your ZM API URL. Whether it's specific to your version or environment, I don't know.
-
sp00ge
Posts: 5
Joined: Thu Dec 16, 2010 9:32 am

Re: Unrecoverable error:Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersi

Post by sp00ge »

Magic919 wrote: Mon Apr 17, 2023 9:19 am Ok. So there's something in your ZMES that is failing to pass on the http/https part of your ZM API URL. Whether it's specific to your version or environment, I don't know.
Thanks for looking. Is there anything I can do to help to troubleshoot this ?
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Unrecoverable error:Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersi

Post by Magic919 »

Can't think of anything. Haven't ever seen the solution for it. I can only suggest trying different version to see what happens.

You could try the Slack channel.
-
sp00ge
Posts: 5
Joined: Thu Dec 16, 2010 9:32 am

Re: Unrecoverable error:Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersi

Post by sp00ge »

Magic919 wrote: Mon Apr 17, 2023 10:20 am Can't think of anything. Haven't ever seen the solution for it. I can only suggest trying different version to see what happens.

You could try the Slack channel.
Thanks again, I will head over to the Slack channel and see if they can help
User avatar
burger
Posts: 390
Joined: Mon May 11, 2020 4:32 pm

Re: Unrecoverable error:Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersi

Post by burger »

I'm not an expert with zmes yet, but post the output of

Code: Select all

sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini  --eventid # --monitorid # --debug
and that might give more information. Also check the config files as mentioned above by tsp.

Just by looking at the error, you can tell it's still seeing the default host/api url somewhere, so look around to see where it is pulling that from. Obviously it's not reading the secrets or objectconfig.ini for some reason (cache? misplaced config file? path? etc)
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
Post Reply