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

Errors when nextcloud not set up, on first start, crashes frontend #99

Open
guysoft opened this issue Apr 28, 2019 · 0 comments
Open

Errors when nextcloud not set up, on first start, crashes frontend #99

guysoft opened this issue Apr 28, 2019 · 0 comments

Comments

@guysoft
Copy link
Collaborator

guysoft commented Apr 28, 2019

Getting:


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/miniconda/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/miniconda/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/miniconda/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/miniconda/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/miniconda/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/miniconda/lib/python3.6/site-packages/rest_framework/views.py", line 483, in dispatch
    response = self.handle_exception(exc)
  File "/miniconda/lib/python3.6/site-packages/rest_framework/views.py", line 443, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/miniconda/lib/python3.6/site-packages/rest_framework/views.py", line 480, in dispatch
    response = handler(request, *args, **kwargs)
  File "/code/ownphotos/urls.py", line 63, in post
    request, *args, **kwargs)
  File "/miniconda/lib/python3.6/site-packages/rest_framework_simplejwt/views.py", line 29, in post
    serializer.is_valid(raise_exception=True)
  File "/miniconda/lib/python3.6/site-packages/rest_framework/serializers.py", line 236, in is_valid
    self._validated_data = self.run_validation(self.initial_data)
  File "/miniconda/lib/python3.6/site-packages/rest_framework/serializers.py", line 437, in run_validation
    value = self.validate(value)
  File "/miniconda/lib/python3.6/site-packages/rest_framework_simplejwt/serializers.py", line 63, in validate
    data = super(TokenObtainPairSerializer, self).validate(attrs)
  File "/miniconda/lib/python3.6/site-packages/rest_framework_simplejwt/serializers.py", line 35, in validate
    'password': attrs['password'],
  File "/miniconda/lib/python3.6/site-packages/django/contrib/auth/__init__.py", line 73, in authenticate
    user = backend.authenticate(request, **credentials)
  File "/miniconda/lib/python3.6/site-packages/django/contrib/auth/backends.py", line 16, in authenticate
    user = UserModel._default_manager.get_by_natural_key(username)
  File "/miniconda/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 44, in get_by_natural_key
    return self.get(**{self.model.USERNAME_FIELD: username})
  File "/miniconda/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/miniconda/lib/python3.6/site-packages/django/db/models/query.py", line 393, in get
    num = len(clone)
  File "/miniconda/lib/python3.6/site-packages/django/db/models/query.py", line 250, in __len__
    self._fetch_all()
  File "/miniconda/lib/python3.6/site-packages/django/db/models/query.py", line 1186, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/miniconda/lib/python3.6/site-packages/django/db/models/query.py", line 54, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/miniconda/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1065, in execute_sql
    cursor.execute(sql, params)
  File "/miniconda/lib/python3.6/site-packages/django/db/backends/utils.py", line 100, in execute
    return super().execute(sql, params)
  File "/miniconda/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/miniconda/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/miniconda/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "/miniconda/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/miniconda/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "api_user" does not exist
LINE 1: ...word", "api_user"."nextcloud_scan_directory" FROM "api_user"...

This makes the frontend crash.

Looks like the line is:

    def post(self, request, *args, **kwargs):
        # ipdb.set_trace()
        response = super(TokenObtainPairView, self).post(
            request, *args, **kwargs)

I guess it gave issues before because of the commented ipdb.set_trace.

Workaround seems to be to stop then start the container after first creation.

@guysoft guysoft changed the title Errors when nextcloud not set up, on first start Errors when nextcloud not set up, on first start, crashes frontend Apr 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant