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

SCRAM authentication error when running Docker compose up #759

Closed
RajatRajdeep opened this issue May 1, 2023 · 4 comments
Closed

SCRAM authentication error when running Docker compose up #759

RajatRajdeep opened this issue May 1, 2023 · 4 comments

Comments

@RajatRajdeep
Copy link
Contributor

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 (6721bf2).
  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
Copy link

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
Copy link

Yup, same env variable resolved it for me as well

@RajatRajdeep
Copy link
Contributor Author

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

@RajatRajdeep
Copy link
Contributor Author

PR to resolve this issue: #761.
Please review this.

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

4 participants