CERNDocumentServer / cds-ils

CERN Library integrated library system.
https://catalogue.library.cern
MIT License
8 stars 14 forks source link

Create library location in demo data in setup step #844

Closed sakshamarora1 closed 5 months ago

sakshamarora1 commented 5 months ago

Fix for the following error:

127.0.0.1 - - [13/Dec/2023 15:12:16] "GET /api/oauth/login/cern_openid/?next=%2F HTTP/1.1" 302 -
127.0.0.1 - - [13/Dec/2023 15:12:34] "GET /api/oauth/authorized/cern_openid/<REDACTED>" 302 -
[2023-12-13 15:12:36,163] ERROR in app: Exception on /me [GET]
Traceback (most recent call last):
  File "/Users/saksham/.virtualenvs/cds-ils-test/lib/python3.6/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/saksham/.virtualenvs/cds-ils-test/lib/python3.6/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/saksham/.virtualenvs/cds-ils-test/lib/python3.6/site-packages/flask_cors/extension.py", line 176, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/Users/saksham/.virtualenvs/cds-ils-test/lib/python3.6/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/saksham/.virtualenvs/cds-ils-test/lib/python3.6/site-packages/flask_debugtoolbar/__init__.py", line 157, in dispatch_request
    return view_func(**req.view_args)
  File "/Users/saksham/.virtualenvs/cds-ils-test/lib/python3.6/site-packages/flask_login/utils.py", line 261, in decorated_view
    return func(*args, **kwargs)
  File "/Users/saksham/.virtualenvs/cds-ils-test/lib/python3.6/site-packages/flask/views.py", line 84, in view
    return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
  File "/Users/saksham/.virtualenvs/cds-ils-test/lib/python3.6/site-packages/flask/views.py", line 158, in dispatch_request
    return current_app.ensure_sync(meth)(*args, **kwargs)
  File "/Users/saksham/.virtualenvs/cds-ils-test/lib/python3.6/site-packages/invenio_accounts/views/rest.py", line 249, in get
    return self.success_response(current_user)
  File "/Users/saksham/.virtualenvs/cds-ils-test/lib/python3.6/site-packages/invenio_app_ils/views.py", line 31, in success_response
    loc_pid_value, _ = current_app_ils.get_default_location_pid
  File "/Users/saksham/.virtualenvs/cds-ils-test/lib/python3.6/site-packages/werkzeug/utils.py", line 97, in __get__
    value = self.fget(obj)  # type: ignore
  File "/Users/saksham/.virtualenvs/cds-ils-test/lib/python3.6/site-packages/invenio_app_ils/ext.py", line 67, in get_default_location_pid
    raise KeyError("There are no locations defined in the system.")
KeyError: 'There are no locations defined in the system.'
127.0.0.1 - - [13/Dec/2023 15:12:36] "GET /api/me HTTP/1.1" 500 -

Steps to reproduce:

  1. Follow INSTALL.rst and start the server.
  2. Login with CERN OAUTH