SSO Broken - The requested URL or resource could not be found

I use Memberful as my SSO and after a rebuild today I started getting the error “The requested URL or resource could not be found.” when logging in to Discourse, I can’t even get into the admin side now. I am able to login into Memberful successfully, just can’t get into Discourse. How do I troubleshoot from here? I have rebuilt with no plugins, ran discourse-doctor and I don’t see anything strange.

Prior to rebuilding I was having issues with new member signups not being created as a user in Discourse. I was getting the following errors in the console, but after the rebuild even existing users can’t login. Please help!

And, this was Memberful’s response to this issue:

He said this looks like an issue in the forum itself. We’re not sure if it is related to the screenshot you sent us (the original error log screenshot), but when we try to synchronize members, we receive an internal server error:

Oops - Error 500


The software powering this discussion forum encountered an unexpected problem. We apologize for the inconvenience.

Detailed information about the error was logged, and an automatic notification generated. We'll take a look at it.

No further action is necessary. However, if the error condition persists, you can provide additional detail, including steps to reproduce the error, by posting a discussion topic in the site's feedback category.

This happens for POST requests to /admin/users/sync_sso.

He suggests contacting your Discourse host or admin to see if they can help prevent this error.

Have you tried this to login:

from DiscourseConnect - Official Single-Sign-On for Discourse (sso)

Essetinaly what is saying above, is that when you can’t login as admin while SSO is on you have two option:

  • go to type your admin and try to login (this assume your SMTP server/service) is running.
  • Second option would be use ruby console as exaplined above.

Did you make any changes with respect to tag notifications recently?
If so, you could try to revert those settings from the console.

1 Like

I was able to log in to the site through Memberful. I don’t see any problems.

Given what I know now, I think it was spurious networking and/or Memberful problem.

I was able to login to get admin access again thanks to @pfaffman who reminded me of the /u/admin-login route, thanks Jay!

So the requested url... is not an issue anymore, but the other issue of new users not being created is still is there. Jay, you were able to login because you already had a login, but new users cannot and get the login error.

@RGJ I did make changes to this recently, do you really think this could cause login issues? I created one tag and set it to muted by default, that was the only change.

Sorry this is a bit scattershot, there were a lot of issues going on this morning!

Up until an hour ago, no. But the idx_tag_users_ix1 index is complaining. It might be corrupt, so we might be fighting symptoms, but disabling those notifications might at least help getting your forum usable again, since those are set upon user creation.

Not with a stack trace and all.


Wow. That’s a masterful catch!

I’m not sure what table that’s in, but

   discourse=# reindex table tag_users;

doesn’t give any errors.

Jay beat me to it as we’ve been talking behind the scenes, but yes Richard this was the solution! You sir are brilliant. I removed the tag from default muted, applied to all users and now it works again. I’ll be doing some testing to see if I can turn this back on to determine if it was just a corruption or some sort of bug. Thank you, thank you!

Edit: a follow up, it was indeed corrupt, I put the tag notification back in place and everything works properly.


I’m afraid this problem is back and now removing the tag that was causing the problem is not working. How do I identify the tag id 842 that I see in the logs? Thanks!

ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "idx_tag_users_ix1" DETAIL: Key (user_id, tag_id, notification_level)=(8118, 842, 0) already exists. )

Logs from attempted user login
rack-mini-profiler (3.0.0) lib/patches/db/pg.rb:69:in `exec_params'
rack-mini-profiler (3.0.0) lib/patches/db/pg.rb:69:in `exec_params'
activerecord (7.0.3) lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `block (2 levels) in exec_no_cache'
activesupport (7.0.3) lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
activesupport (7.0.3) lib/active_support/dependencies/interlock.rb:41:in `permit_concurrent_loads'
activerecord (7.0.3) lib/active_record/connection_adapters/postgresql_adapter.rb:767:in `block in exec_no_cache'
activesupport (7.0.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
activesupport (7.0.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
activesupport (7.0.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
activesupport (7.0.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
activerecord (7.0.3) lib/active_record/connection_adapters/abstract_adapter.rb:765:in `block in log'
activesupport (7.0.3) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activerecord (7.0.3) lib/active_record/connection_adapters/abstract_adapter.rb:756:in `log'
activerecord (7.0.3) lib/active_record/connection_adapters/postgresql_adapter.rb:766:in `exec_no_cache'
activerecord (7.0.3) lib/active_record/connection_adapters/postgresql_adapter.rb:745:in `execute_and_clear'
activerecord (7.0.3) lib/active_record/connection_adapters/postgresql/database_statements.rb:54:in `exec_query'
activerecord (7.0.3) lib/active_record/connection_adapters/abstract/database_statements.rb:150:in `exec_insert_all'
activerecord (7.0.3) lib/active_record/connection_adapters/abstract/query_cache.rb:22:in `exec_insert_all'
activerecord (7.0.3) lib/active_record/insert_all.rb:41:in `execute'
activerecord (7.0.3) lib/active_record/persistence.rb:213:in `insert_all!'
app/models/user.rb:1734:in `set_default_tags_preferences'
activesupport (7.0.3) lib/active_support/callbacks.rb:400:in `block in make_lambda'
activesupport (7.0.3) lib/active_support/callbacks.rb:236:in `block in halting_and_conditional'
activesupport (7.0.3) lib/active_support/callbacks.rb:599:in `block in invoke_after'
activesupport (7.0.3) lib/active_support/callbacks.rb:599:in `each'
activesupport (7.0.3) lib/active_support/callbacks.rb:599:in `invoke_after'
activesupport (7.0.3) lib/active_support/callbacks.rb:108:in `run_callbacks'
activesupport (7.0.3) lib/active_support/callbacks.rb:929:in `_run_create_callbacks'
activerecord (7.0.3) lib/active_record/callbacks.rb:461:in `_create_record'
activerecord (7.0.3) lib/active_record/timestamp.rb:108:in `_create_record'
activerecord (7.0.3) lib/active_record/persistence.rb:1067:in `create_or_update'
activerecord (7.0.3) lib/active_record/callbacks.rb:457:in `block in create_or_update'
activesupport (7.0.3) lib/active_support/callbacks.rb:118:in `block in run_callbacks'
activerecord (7.0.3) lib/active_record/autosave_association.rb:370:in `around_save_collection_association'
activesupport (7.0.3) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
activesupport (7.0.3) lib/active_support/callbacks.rb:138:in `run_callbacks'
activesupport (7.0.3) lib/active_support/callbacks.rb:929:in `_run_save_callbacks'
activerecord (7.0.3) lib/active_record/callbacks.rb:457:in `create_or_update'
activerecord (7.0.3) lib/active_record/timestamp.rb:126:in `create_or_update'
activerecord (7.0.3) lib/active_record/persistence.rb:648:in `save!'
activerecord (7.0.3) lib/active_record/validations.rb:53:in `save!'
activerecord (7.0.3) lib/active_record/transactions.rb:302:in `block in save!'
activerecord (7.0.3) lib/active_record/transactions.rb:354:in `block in with_transaction_returning_status'
activerecord (7.0.3) lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
activesupport (7.0.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
activesupport (7.0.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
activesupport (7.0.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
activesupport (7.0.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
activerecord (7.0.3) lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
activerecord (7.0.3) lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction'
activerecord (7.0.3) lib/active_record/transactions.rb:350:in `with_transaction_returning_status'
activerecord (7.0.3) lib/active_record/transactions.rb:302:in `save!'
activerecord (7.0.3) lib/active_record/suppressor.rb:54:in `save!'
app/models/discourse_connect.rb:260: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:460:in `sync_sso'
actionpack (7.0.3) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (7.0.3) lib/abstract_controller/base.rb:215:in `process_action'
actionpack (7.0.3) lib/action_controller/metal/rendering.rb:53:in `process_action'
actionpack (7.0.3) lib/abstract_controller/callbacks.rb:234:in `block in process_action'
activesupport (7.0.3) lib/active_support/callbacks.rb:118:in `block in run_callbacks'
app/controllers/application_controller.rb:415:in `block in with_resolved_locale'
i18n (1.10.0) lib/i18n.rb:328:in `with_locale'
app/controllers/application_controller.rb:415:in `with_resolved_locale'
activesupport (7.0.3) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
activesupport (7.0.3) lib/active_support/callbacks.rb:138:in `run_callbacks'
actionpack (7.0.3) lib/abstract_controller/callbacks.rb:233:in `process_action'
actionpack (7.0.3) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (7.0.3) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
activesupport (7.0.3) lib/active_support/notifications.rb:206:in `block in instrument'
activesupport (7.0.3) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (7.0.3) lib/active_support/notifications.rb:206:in `instrument'
actionpack (7.0.3) lib/action_controller/metal/instrumentation.rb:66:in `process_action'
actionpack (7.0.3) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
activerecord (7.0.3) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (7.0.3) lib/abstract_controller/base.rb:151:in `process'
actionview (7.0.3) lib/action_view/rendering.rb:39:in `process'
rack-mini-profiler (3.0.0) lib/mini_profiler/profiling_methods.rb:85:in `block in profile_method'
actionpack (7.0.3) lib/action_controller/metal.rb:188:in `dispatch'
actionpack (7.0.3) lib/action_controller/metal.rb:251:in `dispatch'
actionpack (7.0.3) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (7.0.3) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (7.0.3) lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
actionpack (7.0.3) lib/action_dispatch/routing/mapper.rb:48:in `serve'
actionpack (7.0.3) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.3) lib/action_dispatch/journey/router