Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Providers post or retrieval issue #341

Closed
matprov opened this issue Sep 27, 2021 · 1 comment · Fixed by #342
Closed

Providers post or retrieval issue #341

matprov opened this issue Sep 27, 2021 · 1 comment · Fixed by #342
Assignees
Labels
triage/bug Something isn't working

Comments

@matprov
Copy link

matprov commented Sep 27, 2021

Describe the bug

Can't post or retrieve Providers under Weaver 4.0.0.

How to Reproduce

POST /providers

{
  "url": "http://finch:5001/wps",
  "id": "finch",
  "public": true
}

Response, on 1.6.0:

{
    "id": "finch",
    "title": "Finch",
    "abstract": "A Web Processing Service for Climate Indicators",
    "url": "http://10.0.0.3/providers/finch",
    "processes": "http://10.0.0.3/providers/finch/processes",
    "type": "wps",
    "contact": "Lastname, Firstname"
}

Response, on 4.0.0:

{
    "description": "Invalid schema: [{'url': 'Must be a URL'}]",
    "value": null,
    "$schema": "http://10.0.0.3/json#/definitions/CreateProviderRequestBody",
    "schema": "CreateProviderRequestBody"
}

Logs, on 4.0.0:

weaver        | [2021-09-27 14:22:44,314] WARNING  [MainThread][weaver.tweens] Handled request exception:
weaver        |   Cause:  [POST http://10.0.0.3,10.0.0.3/providers]
weaver        |   Raised: [(HTTPBadRequest) <400> The server could not comply with the request since it is either malformed or otherwise incorrect.]
weaver        | 192.168.128.8 - - [27/Sep/2021:14:22:44 +0000] "POST /providers HTTP/1.0" 400 182 "http://10.0.0.3/providers" "PostmanRuntime/7.28.4"

Expected behavior

Supposed to return a 200 OK, not a 400 Bad Request.

Context

Plus, when doing a GET /providers, we get this error:

weaver        | [2021-09-27 14:23:27,621] ERROR    [MainThread][weaver.wps_restapi.providers.providers] Unhandled internal server error. Exception: [Invalid(<weaver.wps_restapi.swagger_definitions.ProvidersBodySchema object at 140284574469008 (named )>, None)]
weaver        | Traceback (most recent call last):
weaver        |   File "/opt/local/src/weaver/weaver/exceptions.py", line 387, in call
weaver        |     return function(*args, **kwargs)
weaver        |   File "/opt/local/src/weaver/weaver/wps_restapi/providers/providers.py", line 71, in get_providers
weaver        |     return HTTPOk(json=sd.ProvidersBodySchema().deserialize(data))
weaver        |   File "/opt/local/src/weaver/weaver/wps_restapi/colander_extras.py", line 570, in deserialize
weaver        |     return ExtendedSchemaNode.deserialize(self, cstruct)  # noqa
weaver        |   File "/opt/local/src/weaver/weaver/wps_restapi/colander_extras.py", line 989, in deserialize
weaver        |     result = colander.MappingSchema.deserialize(self, result)
weaver        |   File "/usr/local/lib/python3.7/site-packages/colander/__init__.py", line 2351, in deserialize
weaver        |     appstruct = self.typ.deserialize(self, cstruct)
weaver        |   File "/usr/local/lib/python3.7/site-packages/colander/__init__.py", line 827, in deserialize
weaver        |     return self._impl(node, cstruct, callback)
weaver        |   File "/usr/local/lib/python3.7/site-packages/colander/__init__.py", line 807, in _impl
weaver        |     raise error
weaver        | colander.Invalid: {'providers': 'Incorrect type cannot distinguish between multiple valid '
weaver        |               "schemas. Must be only one of: ['ProvidersListSchema', "
weaver        |               "'ProviderNamesSchema']."}
weaver        | [2021-09-27 14:23:27,624] ERROR    [MainThread][weaver.tweens] Handled request exception:
weaver        |   Cause:  [GET http://10.0.0.3,10.0.0.3/providers]
weaver        |   Raised: [(HTTPInternalServerError) <500> Unhandled internal server error.]
weaver        | 192.168.128.8 - - [27/Sep/2021:14:23:27 +0000] "GET /providers HTTP/1.0" 500 258 "http://10.0.0.3/providers" "PostmanRuntime/7.28.4"

Notice the Cause: [GET http://10.0.0.3,10.0.0.3/providers], which is similar to the duplicated IP in #292.

  • OS: MacOS
  • Browser : chrome
  • Instance: local
  • Version : 4.0.0
@matprov matprov added the triage/bug Something isn't working label Sep 27, 2021
@fmigneault
Copy link
Collaborator

fmigneault commented Sep 27, 2021

Error occurs because of http://finch:5001/wps being an invalid URL for remote provider registration.
After replacing by http://10.0.0.3/providers/finch, consents are properly retrieved from WPS GetCapabilities response, but parsing of the XML fails.
Finch's XML contains illegal characters such as < within some descriptions. They must be escaped (eg: &lt;).

Temp fix introduced in b020a39
Real issue caused by missing escape: geopython/pywps#628

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants