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

Programming Error Exception Value: relation "social_auth_usersocialauth" does not exist #213

Closed
jifox opened this issue Mar 30, 2021 · 3 comments · Fixed by #214
Closed
Assignees
Labels
type: bug Something isn't working as expected

Comments

@jifox
Copy link
Contributor

jifox commented Mar 30, 2021

Environment

  • Python version: 3.8.5
  • Nautobot version: 1.0.0.b2

Steps to Reproduce

  1. git pull
  2. export PYTHON_VER=3.8.5
  3. invoke destroy
  4. invoke build --no-cache
  5. invoke debug
  6. invoke createsuperuser
  7. Open Browser Login
  8. Exception after send data

I started with a clean directory and made no changes to any of the files

$ git remote -v
origin  https://github.com/nautobot/nautobot.git (fetch)
origin  https://github.com/nautobot/nautobot.git (push)

$ git log
commit 9825f6892fb62fab53e9583bfe780954eaaec2b3 (HEAD -> develop, origin/develop, origin/HEAD)
Author: Glenn Matthews <glenn.matthews@networktocode.com>
Date:   Mon Mar 29 10:12:22 2021 -0400

    Remove obsolete logic to auto-set CSRF_TRUSTED_ORIGINS based on ALLOWED_HOSTS. Fixes #188 (#203)

Expected Behavior

Main screen open in browser

Observed Behavior

Environment:


Request Method: GET
Request URL: http://localhost:8000/

Django Version: 3.1.7
Python Version: 3.8.5
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'cacheops',
 'corsheaders',
 'django_filters',
 'django_tables2',
 'django_prometheus',
 'mptt',
 'rest_framework',
 'taggit',
 'timezone_field',
 'nautobot.core',
 'nautobot.circuits',
 'nautobot.dcim',
 'nautobot.ipam',
 'nautobot.extras',
 'nautobot.tenancy',
 'nautobot.users',
 'nautobot.utilities',
 'nautobot.virtualization',
 'django_rq',
 'drf_yasg',
 'graphene_django',
 'debug_toolbar']
Installed Middleware:
['debug_toolbar.middleware.DebugToolbarMiddleware',
 'django_prometheus.middleware.PrometheusBeforeMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'nautobot.core.middleware.ExceptionHandlingMiddleware',
 'nautobot.core.middleware.RemoteUserMiddleware',
 'nautobot.core.middleware.APIVersionMiddleware',
 'nautobot.core.middleware.ObjectChangeMiddleware',
 'django_prometheus.middleware.PrometheusAfterMiddleware']



Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)

The above exception (relation "social_auth_usersocialauth" does not exist
LINE 1: ...ed", "social_auth_usersocialauth"."modified" FROM "social_au...
                                                             ^
) was the direct cause of the following exception:
  File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 204, in _get_response
    response = response.render()
  File "/usr/local/lib/python3.8/site-packages/django/template/response.py", line 105, in render
    self.content = self.rendered_content
  File "/usr/local/lib/python3.8/site-packages/django/template/response.py", line 83, in rendered_content
    return template.render(context, self._request)
  File "/usr/local/lib/python3.8/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 170, in render
    return self._render(context)
  File "/usr/local/lib/python3.8/site-packages/django/test/utils.py", line 95, in instrumented_test_render
    template_rendered.send(sender=self, template=self, context=context)
  File "/usr/local/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 177, in send
    return [
  File "/usr/local/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 178, in <listcomp>
    (receiver, receiver(signal=self, sender=sender, **named))
  File "/usr/local/lib/python3.8/site-packages/debug_toolbar/panels/templates/panel.py", line 103, in _store_template_info
    if isinstance(value, http.HttpRequest):
  File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py", line 240, in inner
    self._setup()
  File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py", line 376, in _setup
    self._wrapped = self._setupfunc()
  File "/usr/local/lib/python3.8/site-packages/social_django/context_processors.py", line 32, in <lambda>
    return {'backends': LazyDict(lambda: user_backends_data(request.user,
  File "/usr/local/lib/python3.8/site-packages/social_core/backends/utils.py", line 79, in user_backends_data
    set(assoc.provider for assoc in associated))
  File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 287, in __iter__
    self._fetch_all()
  File "/usr/local/lib/python3.8/site-packages/cacheops/query.py", line 273, in _fetch_all
    return self._no_monkey._fetch_all(self)
  File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 1308, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1156, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.8/site-packages/debug_toolbar/panels/sql/tracking.py", line 198, in execute
    return self._record(self.cursor.execute, sql, params)
  File "/usr/local/lib/python3.8/site-packages/debug_toolbar/panels/sql/tracking.py", line 133, in _record
    return method(sql, params)
  File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 98, in execute
    return super().execute(sql, params)
  File "/usr/local/lib/python3.8/site-packages/cacheops/transaction.py", line 93, in execute
    result = self._no_monkey.execute(self, sql, params)
  File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /
Exception Value: relation "social_auth_usersocialauth" does not exist
LINE 1: ...ed", "social_auth_usersocialauth"."modified" FROM "social_au...

@jathanism jathanism added the type: bug Something isn't working as expected label Mar 30, 2021
@jathanism
Copy link
Contributor

Thanks for the report. This is certainly a bug from the latest round of SSO-related changes.

You can work around this temporarily by adding this to your development/nautobot_config.py:

EXTRA_INSTALLED_APPS = ["social_django"]

And then run invoke migrate again.

@jifox
Copy link
Contributor Author

jifox commented Mar 30, 2021

Thanks, Applying the patch is solving the problem

@jifox jifox closed this as completed Mar 30, 2021
@jathanism
Copy link
Contributor

@jifox Well it was a bug so not your fault. Thanks.

@jathanism jathanism added this to the v1.0.0 milestone Mar 30, 2021
@jathanism jathanism removed this from the v1.0.0 milestone Mar 30, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants