DiscourseConnect UniqueViolation su sync_sso

Sto utilizzando DiscourseConnect su un forum tramite Memberful e sto cercando di individuare un errore che potrebbe essere un bug o per cui qualcuno potrebbe consigliare una soluzione alternativa.

Il nome utente sembra essere “nome + numero incrementale”, tuttavia l’utente esiste già, quindi vediamo il messaggio sottostante nel log degli errori.

Non sono sicuro di come venga attivata la sincronizzazione stessa per poterla riprodurre, ma immagino che qualche attività pianificata da qualche parte chiami /admin/users/sync_sso.

Ho installato l’ultimo aggiornamento disponibile la vigilia di Capodanno e ho ricostruito l’app, ecco come appare oggi il log degli errori:

Versione: 2.8.13

Messaggio (33 copie segnalate)

ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_users_on_username"
DETAIL:  Key (username)=(REDACTED) already exists.
)
app/models/discourse_connect.rb:253:in `block in match_email_or_create_user'
lib/distributed_mutex.rb:33:in `block in synchronize'
lib/distributed_mutex.rb:29:in `synchronize'
lib/distributed_mutex.rb:29:in `synchronize'
lib/distributed_mutex.rb:14:in `synchronize'
app/models/discourse_connect.rb:239:in `match_email_or_create_user'
app/models/discourse_connect.rb:121:in `lookup_or_create_user_unsafe'
app/models/discourse_connect.rb:109:in `block in lookup_or_create_user'
lib/distributed_mutex.rb:33:in `block in synchronize'
lib/distributed_mutex.rb:29:in `synchronize'
lib/distributed_mutex.rb:29:in `synchronize'
lib/distributed_mutex.rb:14:in `synchronize'
app/models/discourse_connect.rb:108:in `lookup_or_create_user'
app/controllers/admin/users_controller.rb:471:in `sync_sso'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:361:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:198:in `call'

Backtrace

rack-mini-profiler (2.3.3) lib/patches/db/pg.rb:69:in `exec_params'
rack-mini-profiler (2.3.3) lib/patches/db/pg.rb:69:in `exec_params'
activerecord (6.1.6.1) lib/active_record/connection_adapters/postgresql_adapter.rb:672:in `block (2 levels) in exec_no_cache'
activesupport (6.1.6.1) lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
activesupport (6.1.6.1) lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
activesupport (6.1.6.1) lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
activerecord (6.1.6.1) lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `block in exec_no_cache'
activerecord (6.1.6.1) lib/active_record/connection_adapters/abstract_adapter.rb:696:in `block (2 levels) in log'
activesupport (6.1.6.1) lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
activesupport (6.1.6.1) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'

Env (abbreviato)

REQUEST_URI /admin/users/sync_sso
REQUEST_METHOD POST
HTTP_USER_AGENT http.rb/5.1.0
1 Mi Piace