Travel Sample - Web App - Can not login

Hi All,

when I go through the travel sample tutorial, I encountered an issue:

After installation of all components, when I try to login/create new user, I always get a error message in the interface of web app, as following:

{ “_body”: “<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 3.2 Final//EN”>\n<title>500 Internal Server Error</title>\n<h1>Internal Server Error</h1>\n<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>\n”, “status”: 500, “ok”: false, “statusText”: “INTERNAL SERVER ERROR”, “headers”: { “date”: [ “Fri”, " 28 Dec 2018 23:23:45 GMT" ], “server”: [ “Werkzeug/0.11.15 Python/3.6.3” ], “content-length”: [ “291” ], “content-type”: [ “text/html” ] }, “type”: 2, “url”: “http://localhost:8080/api/user/login” }

The log in the terminal ‘try-cb-python’ is following:
[2018-12-28 15:23:45,500] ERROR in app: Exception on /api/user/login [POST]
Traceback (most recent call last):
File “/anaconda3/lib/python3.6/site-packages/flask/app.py”, line 1982, in wsgi_app
response = self.full_dispatch_request()
File “/anaconda3/lib/python3.6/site-packages/flask/app.py”, line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/anaconda3/lib/python3.6/site-packages/flask/app.py”, line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “/anaconda3/lib/python3.6/site-packages/flask/_compat.py”, line 33, in reraise
raise value
File “/anaconda3/lib/python3.6/site-packages/flask/app.py”, line 1612, in full_dispatch_request
rv = self.dispatch_request()
File “/anaconda3/lib/python3.6/site-packages/flask/app.py”, line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File “/anaconda3/lib/python3.6/site-packages/flask_classy.py”, line 200, in proxy
response = view(**request.view_args)
File “travel.py”, line 157, in login
return jsonify({‘data’: {‘token’: token}})
File “/anaconda3/lib/python3.6/site-packages/flask/json.py”, line 263, in jsonify
(dumps(data, indent=indent, separators=separators), ‘\n’),
File “/anaconda3/lib/python3.6/site-packages/flask/json.py”, line 123, in dumps
rv = _json.dumps(obj, **kwargs)
File “/anaconda3/lib/python3.6/json/init.py”, line 238, in dumps
**kw).encode(obj)
File “/anaconda3/lib/python3.6/json/encoder.py”, line 201, in encode
chunks = list(chunks)
File “/anaconda3/lib/python3.6/json/encoder.py”, line 430, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File “/anaconda3/lib/python3.6/json/encoder.py”, line 404, in _iterencode_dict
yield from chunks
File “/anaconda3/lib/python3.6/json/encoder.py”, line 404, in _iterencode_dict
yield from chunks
File “/anaconda3/lib/python3.6/json/encoder.py”, line 437, in _iterencode
o = _default(o)
File “/anaconda3/lib/python3.6/site-packages/flask/json.py”, line 80, in default
return _json.JSONEncoder.default(self, o)
File “/anaconda3/lib/python3.6/json/encoder.py”, line 180, in default
o.class.name)
TypeError: Object of type ‘bytes’ is not JSON serializable
127.0.0.1 - - [28/Dec/2018 15:23:45] “POST /api/user/login HTTP/1.1” 500 -

Moreover, after I tried to create new user in the interface of web app, I notice that in the couchbase server, I have some new user document created, named as ‘user:demo1’ (I double checked that the new user is created via web app interface but not iOS app simulator).

So what should I do to eliminate these errors?

Thank you very much!

Best regards

Charles

This doesn’t look like a mobile question … did you file it in the wrong category?

Hello,

I have the same issue, I cant create user/login user. I have download the latest version - Couchbase Server 6.0 and I have in my server the travel bucket demo.
Perhaps this problem is for this new version? How can I solve it?

Any help, pls.
Regards!

My output:

Connecting to: couchbase://localhost/travel-sample?username=Administrator
 * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
127.0.0.1 - - [15/Jan/2019 18:27:54] "GET / HTTP/1.1" 302 -
[2019-01-15 18:28:18,258] ERROR in app: Exception on /api/user/signup [POST]
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask_classy.py", line 200, in proxy
    response = view(**request.view_args)
  File "travel.py", line 183, in signup
    respjson = jsonify({'data': {'token': token}})
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/json.py", line 263, in jsonify
    (dumps(data, indent=indent, separators=separators), '\n'),
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/json.py", line 123, in dumps
    rv = _json.dumps(obj, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 201, in encode
    chunks = list(chunks)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 431, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/json.py", line 80, in default
    return _json.JSONEncoder.default(self, o)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable
127.0.0.1 - - [15/Jan/2019 18:28:18] "POST /api/user/signup HTTP/1.1" 500 -

As I said above, this isn’t a mobile question … please ask in one of the Server categories.