crossbar icon indicating copy to clipboard operation
crossbar copied to clipboard

HTTP Bridge Callee url unicode errors

Open 2walkTheMoon opened this issue 8 years ago • 1 comments

I'm attempting to the set up the HTTP Bridge Callee and getting this error with presumably the HTTP URL that the callee is trying to reach. The url in the config JSON file, when parsed by the JSON parser, looks like it isn't being encoded in UTF-8.

2016-06-15T23:46:22+0000 [Container    9600] TypeError: url must be bytes, not unicode: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/autobahn/wamp/protocol.py", line 809, in onMessage
    on_reply = txaio.as_future(endpoint.fn, *invoke_args, **invoke_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/txaio/tx.py", line 408, in as_future
    return maybeDeferred(fun, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 150, in maybeDeferred
    result = f(*args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1274, in unwindGenerator
    return _inlineCallbacks(None, gen, Deferred())
--- <exception caught here> ---
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1128, in _inlineCallbacks
    result = g.send(result)
  File "/usr/local/lib/python2.7/dist-packages/crossbar/adapter/rest/callee.py", line 69, in on_call
    params=params
  File "/usr/local/lib/python2.7/dist-packages/treq/api.py", line 97, in request
    return _client(**kwargs).request(method, url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/treq/client.py", line 175, in request
    bodyProducer=bodyProducer)
  File "/usr/local/lib/python2.7/dist-packages/twisted/web/client.py", line 1918, in request
    deferred = self._agent.request(method, uri, headers, bodyProducer)
  File "/usr/local/lib/python2.7/dist-packages/twisted/web/client.py", line 1986, in request
    deferred = self._agent.request(method, uri, headers, bodyProducer)
  File "/usr/local/lib/python2.7/dist-packages/twisted/web/client.py", line 1592, in request
    parsedURI = URI.fromBytes(uri)
  File "/usr/local/lib/python2.7/dist-packages/twisted/web/client.py", line 629, in fromBytes
    scheme, netloc, path, params, query, fragment = http.urlparse(uri)
  File "/usr/local/lib/python2.7/dist-packages/twisted/web/http.py", line 169, in urlparse
    raise TypeError("url must be bytes, not unicode")
exceptions.TypeError: url must be bytes, not unicode

This looks very similar to this treq issue filed and still open: https://github.com/twisted/treq/issues/54.

I'm just running "crossbar start" to launch crossbar.

My config is copied straight out of the examples on http://crossbar.io/ and the presumably relevant parts look this:

        {
            "type": "container",
            "options": {
                "pythonpath": [".."]
            },
            "components": [
                {
                    "type": "class",
                    "classname": "crossbar.adapter.rest.RESTCallee",
                    "realm": "realm1",
                    "extra": {
                        "procedure": "nimblets.backend",
                        "baseurl": "https://httpbin.org/"
                    },
                    "transport": {
                        "type": "websocket",
                        "endpoint": {
                            "type": "tcp",
                            "host": "127.0.0.1",
                            "port": 8080
                        },
                        "url": "ws://127.0.0.1:8080/ws"
                    }
                }
            ]
        } 

I don't see mentions of this issue on the crossbar mailing list though. Is this something being worked around or is this a case of user error somehow?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

2walkTheMoon avatar Jun 16 '16 17:06 2walkTheMoon

@2walkTheMoon can you post the output of crossbar version please? (This is Python3, right?) Also details of your OS (and if Linux, the distribution). Thanks!

meejah avatar Sep 17 '16 18:09 meejah