Page 1 of 1

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

Posted: Sat Jul 02, 2022 10:40 pm
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?

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

Posted: Sun Jul 03, 2022 2:03 am
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>

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

Posted: Sun Jul 03, 2022 12:46 pm
by ArloEardley
I am afraid this is not it. Is it perhaps an apache2 problem? Here are my secrets and objectconfig.ini to reference.

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

Posted: Sun Apr 16, 2023 4:28 pm
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

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

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

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

Posted: Mon Apr 17, 2023 8:13 am
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"}

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

Posted: Mon Apr 17, 2023 9:19 am
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.

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

Posted: Mon Apr 17, 2023 9:53 am
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 ?

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

Posted: Mon Apr 17, 2023 10:20 am
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.

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

Posted: Mon Apr 17, 2023 11:49 am
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

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

Posted: Tue Apr 18, 2023 1:41 am
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)