Cognito strategy not found
- I have deployed GitLab using Helm Charts on EKS.
- Then I tried to configure authentication via AWS Cognito, using chart values.
- My deployment starts a new web-service pod, which contains the following error: /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/devise-4.9.4/lib/devise/omniauth/config.rb:42:in
autoload_strategy': Could not find a strategy with name
Cognito'
Steps to reproduce
I've tried the configuration contained in gitlab docs, and didn't find any open issue abot this problem. Also, I tried to use OAuth2_generic as provider, passing the cognito secret with other OAuth2 Generic name and strategy class, when not declaring strategy class, i get strategy not found error
Configuration
Values.yaml:
certmanager:
install: false
certmanager-issuer:
email: email
gitlab:
webservice:
resources:
requests:
memory: 1Gi
gitaly:
persistance:
enabled: true
size: 100Gi
storageClass: sc-efs
global:
edition: ce
hosts:
domain: domain
https: false
ingress:
annotations: {}
class: nginx
configureCertmanager: false
psql:
database: gitlabhq_production
host: host
password:
useSecret: secret
port: 5432
username: gitlab
redis:
auth:
key: key
secret: secret
host: host
time_zone: America/Sao_Paulo
appConfig:
omniauth:
enabled: true
allowSingleSignOn: ['oauth2_generic']
autoLinkUser: ['oauth2_generic']
syncProfileFromProvider: ['oauth2_generic']
providers:
- secret: 'cognito-secret'
key: 'provider'
grafana:
enabled: false
minio:
persistence:
size: 300Gi
storageClass: sc-efs
nginx-ingress:
enabled: false
postgresql:
install: false
prometheus:
install: false
redis:
install: false
provider secret:
apiVersion: v1
kind: Secret
metadata:
name: cognito-secret
namespace: gitlab
stringData:
provider: |
name: "cognito"
label: "AWS Cognito"
app_id: "id"
app_secret: "secret"
args:
client_options:
authorize_url: "/oauth2/authorize"
token_url: "/oauth2/token"
user_info_url: "/oauth2/userInfo"
site: 'correct domain'
user_response_structure:
attributes:
email: "email"
name: "name"
authorize_params:
scope: "openid profile email"
strategy_class: "OmniAuth::Strategies::CognitoOauth2"
Error when not daclaring strategy class:
undler: failed to load command: puma (/srv/gitlab/vendor/bundle/ruby/3.2.0/bin/puma)
/srv/gitlab/vendor/bundle/ruby/3.2.0/gems/devise-4.9.3/lib/devise/omniauth/config.rb:42:in `autoload_strategy': Could not find a strategy with name `Cognito'. Please ensure it is required or explicitly set it using the :strategy_class option. (Devise::OmniAuth::StrategyNotFound)
raise StrategyNotFound, name
^^^^^
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/devise-4.9.3/lib/devise/omniauth/config.rb:27:in `strategy_class'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/devise-4.9.3/lib/devise/rails.rb:30:in `block (2 levels) in <class:Engine>'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/devise-4.9.3/lib/devise/rails.rb:29:in `each'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/devise-4.9.3/lib/devise/rails.rb:29:in `block in <class:Engine>'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/initializable.rb:32:in `instance_exec'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/initializable.rb:32:in `run'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/initializable.rb:61:in `block in run_initializers'
from /usr/lib/ruby/3.2.0/tsort.rb:228:in `block in tsort_each'
from /usr/lib/ruby/3.2.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /usr/lib/ruby/3.2.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /usr/lib/ruby/3.2.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /usr/lib/ruby/3.2.0/tsort.rb:347:in `each'
from /usr/lib/ruby/3.2.0/tsort.rb:347:in `call'
from /usr/lib/ruby/3.2.0/tsort.rb:347:in `each_strongly_connected_component'
from /usr/lib/ruby/3.2.0/tsort.rb:226:in `tsort_each'
from /usr/lib/ruby/3.2.0/tsort.rb:205:in `tsort_each'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/initializable.rb:60:in `run_initializers'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/application.rb:372:in `initialize!'
from /srv/gitlab/config/environment.rb:7:in `<top (required)>'
from <internal:/usr/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from <internal:/usr/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from /srv/gitlab/config.ru:5:in `block in <main>'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/rack-2.2.10/lib/rack/builder.rb:116:in `eval'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/rack-2.2.10/lib/rack/builder.rb:116:in `new_from_string'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/rack-2.2.10/lib/rack/builder.rb:105:in `load_file'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/rack-2.2.10/lib/rack/builder.rb:66:in `parse_file'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/puma-6.5.0/lib/puma/configuration.rb:384:in `load_rackup'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/puma-6.5.0/lib/puma/configuration.rb:297:in `app'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/puma-6.5.0/lib/puma/runner.rb:166:in `load_and_bind'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/puma-6.5.0/lib/puma/cluster.rb:369:in `run'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/puma-6.5.0/lib/puma/launcher.rb:196:in `run'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/puma-6.5.0/lib/puma/cli.rb:75:in `run'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/puma-6.5.0/bin/puma:10:in `<top (required)>'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/bin/puma:25:in `load'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/bin/puma:25:in `<top (required)>'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.3/lib/bundler/cli/exec.rb:59:in `load'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.3/lib/bundler/cli/exec.rb:59:in `kernel_load'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.3/lib/bundler/cli/exec.rb:23:in `run'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.3/lib/bundler/cli.rb:452:in `exec'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor.rb:538:in `dispatch'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.3/lib/bundler/cli.rb:35:in `dispatch'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.3/lib/bundler/cli.rb:29:in `start'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.3/exe/bundle:28:in `block in <top (required)>'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.3/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.3/exe/bundle:20:in `<top (required)>'
from /srv/gitlab/bin/bundle:5:in `load'
Error when declaring strategy class "CognitoOauth2":
{"timestamp":"2025-04-03T12:44:10.969Z","pid":20,"message":"! Unable to load application: NameError: uninitialized constant OmniAuth::Strategies::CognitoOauth2"}
bundler: failed to load command: puma (/srv/gitlab/vendor/bundle/ruby/3.2.0/bin/puma)
/srv/gitlab/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8.7/lib/active_support/inflector/methods.rb:278:in `constantize': uninitialized constant OmniAuth::Strategies::CognitoOauth2 (NameError)
Object.const_get(camel_cased_word)
^^^^^^^^^^
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8.7/lib/active_support/core_ext/string/inflections.rb:74:in `constantize'
from /srv/gitlab/lib/gitlab/omniauth_initializer.rb:101:in `normalize_hash_arguments'
from /srv/gitlab/lib/gitlab/omniauth_initializer.rb:67:in `arguments_for'
from /srv/gitlab/lib/gitlab/omniauth_initializer.rb:16:in `block in execute'
from /srv/gitlab/lib/gitlab/omniauth_initializer.rb:13:in `each'
from /srv/gitlab/lib/gitlab/omniauth_initializer.rb:13:in `execute'
from /srv/gitlab/config/initializers/8_devise.rb:257:in `block in <main>'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/devise-4.9.4/lib/devise.rb:314:in `setup'
from /srv/gitlab/config/initializers/8_devise.rb:7:in `<main>'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/engine.rb:667:in `load'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/engine.rb:667:in `block in load_config_initializer'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8.7/lib/active_support/notifications.rb:208:in `instrument'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/engine.rb:666:in `load_config_initializer'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/engine.rb:619:in `each'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/engine.rb:619:in `block in <class:Engine>'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/initializable.rb:32:in `instance_exec'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/initializable.rb:32:in `run'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/initializable.rb:61:in `block in run_initializers'
from /usr/lib/ruby/3.2.0/tsort.rb:228:in `block in tsort_each'
from /usr/lib/ruby/3.2.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /usr/lib/ruby/3.2.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
from /usr/lib/ruby/3.2.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /usr/lib/ruby/3.2.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/initializable.rb:50:in `each'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/initializable.rb:50:in `tsort_each_child'
from /usr/lib/ruby/3.2.0/tsort.rb:415:in `call'
from /usr/lib/ruby/3.2.0/tsort.rb:415:in `each_strongly_connected_component_from'
from /usr/lib/ruby/3.2.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /usr/lib/ruby/3.2.0/tsort.rb:347:in `each'
from /usr/lib/ruby/3.2.0/tsort.rb:347:in `call'
from /usr/lib/ruby/3.2.0/tsort.rb:347:in `each_strongly_connected_component'
from /usr/lib/ruby/3.2.0/tsort.rb:226:in `tsort_each'
from /usr/lib/ruby/3.2.0/tsort.rb:205:in `tsort_each'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/initializable.rb:60:in `run_initializers'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.7/lib/rails/application.rb:372:in `initialize!'
from /srv/gitlab/config/environment.rb:7:in `<top (required)>'
from <internal:/usr/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from <internal:/usr/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from /srv/gitlab/config.ru:5:in `block in <main>'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/rack-2.2.11/lib/rack/builder.rb:116:in `eval'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/rack-2.2.11/lib/rack/builder.rb:116:in `new_from_string'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/rack-2.2.11/lib/rack/builder.rb:105:in `load_file'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/rack-2.2.11/lib/rack/builder.rb:66:in `parse_file'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/puma-6.5.0/lib/puma/configuration.rb:384:in `load_rackup'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/puma-6.5.0/lib/puma/configuration.rb:297:in `app'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/puma-6.5.0/lib/puma/runner.rb:166:in `load_and_bind'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/puma-6.5.0/lib/puma/cluster.rb:369:in `run'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/puma-6.5.0/lib/puma/launcher.rb:196:in `run'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/puma-6.5.0/lib/puma/cli.rb:75:in `run'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/gems/puma-6.5.0/bin/puma:10:in `<top (required)>'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/bin/puma:25:in `load'
from /srv/gitlab/vendor/bundle/ruby/3.2.0/bin/puma:25:in `<top (required)>'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.6/lib/bundler/cli/exec.rb:59:in `load'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.6/lib/bundler/cli/exec.rb:59:in `kernel_load'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.6/lib/bundler/cli/exec.rb:23:in `run'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.6/lib/bundler/cli.rb:452:in `exec'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.6/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.6/lib/bundler/vendor/thor/lib/thor.rb:538:in `dispatch'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.6/lib/bundler/cli.rb:35:in `dispatch'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.6/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.6/lib/bundler/cli.rb:29:in `start'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.6/exe/bundle:28:in `block in <top (required)>'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.6/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
from /usr/lib/ruby/gems/3.2.0/gems/bundler-2.6.6/exe/bundle:20:in `<top (required)>'
from /srv/gitlab/bin/bundle:5:in `load'
from /srv/gitlab/bin/bundle:5:in `<main>'