pythonindia / junction

Junction is a software to manage proposals, reviews, schedule, feedback during conference.
MIT License
192 stars 185 forks source link

SCRAM authentication error when running Docker compose up #759

Closed RajatRajdeep closed 1 year ago

RajatRajdeep commented 1 year ago

When attempting to run Docker Compose up for the Junction project locally, I received the following error message: django.db.utils.OperationalError: SCRAM authentication requires libpq version 10 or above

Steps to reproduce:

  1. copy .env.sample and paste it as .env file
  2. Build junction_local image using following command: docker build -t junction_local . --platform=linux/amd64
  3. Run the command "docker-compose up" to start the project.

More Details:

  1. Machine: Apple M1 - Ventura 13.3.1
  2. Commit id: Fix conference moderator filter (6721bf2a5b1c4b644b34b48531a7f59859f94959).
  3. Branch: upgrade-junction.

Please find below traceback: [+] Running 4/0 ⠿ Container junction-redis-1 Running 0.0s ⠿ Container junction-db-1 Running 0.0s ⠿ Container junction-web-1 Created 0.0s ⠿ Container junction-celery-1 Running 0.0s Attaching to junction-celery-1, junction-db-1, junction-redis-1, junction-web-1 junction-web-1 | Monkey patching... junction-web-1 | Traceback (most recent call last): junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection junction-web-1 | self.connect() junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner junction-web-1 | return func(*args, kwargs) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 200, in connect junction-web-1 | self.connection = self.get_new_connection(conn_params) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner junction-web-1 | return func(*args, kwargs) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection junction-web-1 | connection = Database.connect(conn_params) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/psycopg2/init.py", line 122, in connect junction-web-1 | conn = _connect(dsn, connection_factory=connection_factory, *kwasync) junction-web-1 | psycopg2.OperationalError: SCRAM authentication requires libpq version 10 or above junction-web-1 | junction-web-1 | junction-web-1 | The above exception was the direct cause of the following exception: junction-web-1 | junction-web-1 | Traceback (most recent call last): junction-web-1 | File "/code/manage.py", line 10, in junction-web-1 | execute_from_command_line(sys.argv) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/core/management/init.py", line 419, in execute_from_command_line junction-web-1 | utility.execute() junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/core/management/init.py", line 413, in execute junction-web-1 | self.fetch_command(subcommand).run_from_argv(self.argv) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 354, in run_from_argv junction-web-1 | self.execute(args, cmd_options) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 398, in execute junction-web-1 | output = self.handle(*args, options) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 89, in wrapped junction-web-1 | res = handle_func(args, kwargs) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 75, in handle junction-web-1 | self.check(databases=[database]) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 419, in check junction-web-1 | all_issues = checks.run_checks( junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/core/checks/registry.py", line 76, in run_checks junction-web-1 | new_errors = check(app_configs=app_configs, databases=databases) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/core/checks/model_checks.py", line 34, in check_all_models junction-web-1 | errors.extend(model.check(kwargs)) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/models/base.py", line 1290, in check junction-web-1 | cls._check_indexes(databases), junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/models/base.py", line 1680, in _check_indexes junction-web-1 | connection.features.supports_covering_indexes or junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 48, in get junction-web-1 | res = instance.dict[self.name] = self.func(instance) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/backends/postgresql/features.py", line 93, in is_postgresql_11 junction-web-1 | return self.connection.pg_version >= 110000 junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 48, in get junction-web-1 | res = instance.dict[self.name] = self.func(instance) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/backends/postgresql/base.py", line 329, in pg_version junction-web-1 | with self.temporary_connection(): junction-web-1 | File "/usr/local/lib/python3.10/contextlib.py", line 135, in enter junction-web-1 | return next(self.gen) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 603, in temporary_connection junction-web-1 | with self.cursor() as cursor: junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner junction-web-1 | return func(*args, *kwargs) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 259, in cursor junction-web-1 | return self._cursor() junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 235, in _cursor junction-web-1 | self.ensure_connection() junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner junction-web-1 | return func(args, kwargs) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 218, in ensure_connection junction-web-1 | with self.wrap_database_errors: junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/utils.py", line 90, in exit junction-web-1 | raise dj_exc_value.with_traceback(traceback) from exc_value junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection junction-web-1 | self.connect() junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner junction-web-1 | return func(*args, *kwargs) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 200, in connect junction-web-1 | self.connection = self.get_new_connection(conn_params) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner junction-web-1 | return func(args, kwargs) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection junction-web-1 | connection = Database.connect(conn_params) junction-web-1 | File "/usr/local/lib/python3.10/site-packages/psycopg2/init.py", line 122, in connect junction-web-1 | conn = _connect(dsn, connection_factory=connection_factory, **kwasync) junction-web-1 | django.db.utils.OperationalError: SCRAM authentication requires libpq version 10 or above junction-web-1 | junction-web-1 exited with code 1

leshravnya commented 1 year ago

I faced this same issue. I followed the fix in this link. https://stackoverflow.com/a/70238851

It is an issue with the Apple Silicon and libpq.

miphilomath commented 1 year ago

Yup, same env variable resolved it for me as well

RajatRajdeep commented 1 year ago

I tried this but forgot to rebuild the image. After rebuilding the image, It's working fine now. Thanks @leshravnya, @miphilomath.

RajatRajdeep commented 1 year ago

PR to resolve this issue: https://github.com/pythonindia/junction/pull/761. Please review this.