Hello

I am trying to run Redash in Kubernetes. I get the an error 500 on the redirect to /login on both version 8.0 and 9.0

version 8.0.2.b37747:
Traceback (most recent call last):
File “/usr/local/lib/python2.7/site-packages/flask/app.py”, line 1982, in wsgi_app
response = self.full_dispatch_request()
File “/usr/local/lib/python2.7/site-packages/flask/app.py”, line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/usr/local/lib/python2.7/site-packages/flask_restful/init.py”, line 271, in error_router
return original_handler(e)
File “/usr/local/lib/python2.7/site-packages/flask/app.py”, line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “/usr/local/lib/python2.7/site-packages/flask/app.py”, line 1612, in full_dispatch_request
rv = self.dispatch_request()
File “/usr/local/lib/python2.7/site-packages/flask/app.py”, line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File “/usr/local/lib/python2.7/site-packages/flask_limiter/extension.py”, line 442, in __inner
return obj(*a, **k)
File “/app/redash/handlers/authentication.py”, line 147, in login
if current_org == None and not settings.MULTI_ORG:
File “/usr/local/lib/python2.7/site-packages/werkzeug/local.py”, line 365, in
eq = lambda x, o: x._get_current_object() == o
File “/usr/local/lib/python2.7/site-packages/werkzeug/local.py”, line 302, in _get_current_object
return self.__local()
File “/app/redash/authentication/org_resolving.py”, line 18, in _get_current_org
g.org = Organization.get_by_slug(slug)
File “/app/redash/models/organizations.py”, line 33, in get_by_slug
return cls.query.filter(cls.slug == slug).first()
File “/usr/local/lib/python2.7/site-packages/flask_sqlalchemy/init.py”, line 514, in get
return type.query_class(mapper, session=self.sa.session())
File “/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/scoping.py”, line 74, in call
return self.registry()
File "/usr/local/lib/python2.7/site-packages/sqlalchemy/util/collections.py", line 1001, in call
return self.registry.setdefault(key, self.createfunc())
File “/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py”, line 2950, in call
return self.class
(**local_kw)
File “/usr/local/lib/python2.7/site-packages/flask_sqlalchemy/init.py”, line 143, in init
bind = options.pop(‘bind’, None) or db.engine
File “/usr/local/lib/python2.7/site-packages/flask_sqlalchemy/init.py”, line 877, in engine
return self.get_engine()
File “/usr/local/lib/python2.7/site-packages/flask_sqlalchemy/init.py”, line 896, in get_engine
return connector.get_engine()
File “/usr/local/lib/python2.7/site-packages/flask_sqlalchemy/init.py”, line 559, in get_engine
self._engine = rv = sqlalchemy.create_engine(info, **options)
File “/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/init.py”, line 425, in create_engine
return strategy.create(*args, **kwargs)
File “/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py”, line 57, in create
entrypoint = u._get_entrypoint()
File “/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/url.py”, line 156, in _get_entrypoint
cls = registry.load(name)
File “/usr/local/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py”, line 221, in load
(self.group, name))
NoSuchModuleError: Can’t load plugin: sqlalchemy.dialects:postgreql

version v9.0.0-beta:
[2021-01-25 05:49:48,219][PID:19][ERROR][redash.app] Exception on /login [GET]
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/util/_collections.py”, line 1010, in call
return self.registry[key]
KeyError: <greenlet.greenlet object at 0x7fc4dbb0c9f0>

During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
        response = self.full_dispatch_request()
      File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
        rv = self.handle_user_exception(e)
      File "/usr/local/lib/python3.7/site-packages/flask_restful/__init__.py", line 269, in error_router
        return original_handler(e)
      File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
        reraise(exc_type, exc_value, tb)
      File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
        raise value
      File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
        rv = self.dispatch_request()
      File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
        return self.view_functions[rule.endpoint](**req.view_args)
      File "/usr/local/lib/python3.7/site-packages/flask_limiter/extension.py", line 442, in __inner
        return obj(*a, **k)
      File "/app/redash/handlers/authentication.py", line 189, in login
        if current_org == None and not settings.MULTI_ORG:
      File "/usr/local/lib/python3.7/site-packages/werkzeug/local.py", line 370, in <lambda>
        __eq__ = lambda x, o: x._get_current_object() == o
      File "/usr/local/lib/python3.7/site-packages/werkzeug/local.py", line 307, in _get_current_object
        return self.__local()
      File "/app/redash/authentication/org_resolving.py", line 18, in _get_current_org
        g.org = Organization.get_by_slug(slug)
      File "/app/redash/models/organizations.py", line 31, in get_by_slug
        return cls.query.filter(cls.slug == slug).first()
      File "/usr/local/lib/python3.7/site-packages/flask_sqlalchemy/__init__.py", line 519, in __get__
        return type.query_class(mapper, session=self.sa.session())
      File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/scoping.py", line 78, in __call__
        return self.registry()
      File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/_collections.py", line 1012, in __call__
        return self.registry.setdefault(key, self.createfunc())
      File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 3225, in __call__
        return self.class_(**local_kw)
      File "/usr/local/lib/python3.7/site-packages/flask_sqlalchemy/__init__.py", line 138, in __init__
        bind = options.pop('bind', None) or db.engine
      File "/usr/local/lib/python3.7/site-packages/flask_sqlalchemy/__init__.py", line 937, in engine
        return self.get_engine()
      File "/usr/local/lib/python3.7/site-packages/flask_sqlalchemy/__init__.py", line 956, in get_engine
        return connector.get_engine()
      File "/usr/local/lib/python3.7/site-packages/flask_sqlalchemy/__init__.py", line 561, in get_engine
        self._engine = rv = self._sa.create_engine(sa_url, options)
      File "/usr/local/lib/python3.7/site-packages/flask_sqlalchemy/__init__.py", line 966, in create_engine
        return sqlalchemy.create_engine(sa_url, **engine_opts)
      File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/__init__.py", line 479, in create_engine
        return strategy.create(*args, **kwargs)
      File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/strategies.py", line 61, in create
        entrypoint = u._get_entrypoint()
      File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/url.py", line 172, in _get_entrypoint
        cls = registry.load(name)
      File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 240, in load
        "Can't load plugin: %s:%s" % (self.group, name)
    sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgreql
    [2021-01-25 05:49:48,223][PID:19][INFO][metrics] method=GET path=/login endpoint=redash_login status=500 content_type=text/html content_length=290 duration=93.48 query_count=0 query_duration=0.00
    [2021-01-25 05:49:48,224][PID:19][INFO][metrics] method=GET path=/login endpoint=redash_login status=500 content_type=? content_length=-1 duration=94.03 query_count=0 query_duration=0.00

I could not use the setup.sh script nor the docker-compose but I made sure to setup all env var and commands accordingly. I also have the create_db command

All the containers (server, postgres, nginx, scheduler, …) are running properly when I sent the request.

I found the cause of the issue, I had a typo in the scheme of my connection string!
It should be: postgresql://postgres:$(POSTGRES_PASSWORD)@127.0.0.1/postgres

and not postgreql://postgres:$(POSTGRES_PASSWORD)@127.0.0.1/postgres

1 Like

Thank you so much for sharing your solution!