inveniosoftware / troubleshooting

DEPRECATED - Use the forum instead:
https://invenio-talk.web.cern.ch
5 stars 4 forks source link

Tests fail: ValueError/TypeError: 'RequestError' object is not callable - GET /api/records/ 500 #24

Open ntarocco opened 7 years ago

ntarocco commented 7 years ago

If you encounter this kind of stacktraces and errors:

output = json.loads(
>           subprocess.check_output(cmd, shell=True).decode('utf-8'))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/python/2.7.13/lib/python2.7/json/__init__.py:339: in loads
    return _default_decoder.decode(s)
/opt/python/2.7.13/lib/python2.7/json/decoder.py:364: in decode

    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
>           raise ValueError("No JSON object could be decoded")
E           ValueError: No JSON object could be decoded

/opt/python/2.7.13/lib/python2.7/json/decoder.py:382: ValueError
"GET /api/records/?q=wall HTTP/1.1" 500 -
File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/flask/app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/flask/app.py", line 1746, in make_response
    rv = self.response_class.force_type(rv, request.environ)
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/werkzeug/wrappers.py", line 885, in force_type
    response = BaseResponse(*_run_wsgi_app(response, environ))
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/werkzeug/wrappers.py", line 57, in _run_wsgi_app
    return _run_wsgi_app(*args)
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/werkzeug/test.py", line 884, in run_wsgi_app
    app_rv = app(environ, start_response)
TypeError: 'RequestError' object is not callable

then it could be that the ElasticSearch version installed on Travis is wrong.

In Travis build log, check the ElasticSearch version under Build system information, it should be one of the supported versions.

ppanero commented 6 years ago

Added Note: This error seems to be thrown not only for version mismatch, but for every ES error. In my case a date format was not been properly parsed and the ES error was not propagated.