tkrunning
(Thomas K. Running)
August 3, 2023, 9:44am
1
I’ve run into another strange bug over the past few days on my Discourse instance. I cannot save any user preferences for my own admin user, I just get 500 errors. It seems to be the same for any PUT
request to u/[MY_USERNAME].json
.
I also tried to repeat the same request in Postman using a valid API key, but that failed as well:
I don’t see any errors showing up on /logs either.
Other user accounts don’t seem to be affected, at least the ones I tried.
Upgraded Discourse to the latest version yesterday, but the issue was present before the upgrade, too.
Any ideas for how I can continue debugging this?
david
(David Taylor)
August 3, 2023, 10:05am
2
If you visit /logs
on your Discourse instance while logged in as an admin, it should show you more details on errors like this. If you can share the contents of the ‘info’ and ‘backtrace’ tabs for the relevant error, that’ll help us track down the problem.
Edit: oh I see you already looked there . Could you double check that you have all the error types enabled in the bottom left of /logs
?
tkrunning
(Thomas K. Running)
August 3, 2023, 10:24am
3
So I guess it might actually have been this error:
I figured that one was just showing up due to this issue:
However, it turns out it’s all related.
Here are the full logs:
Info:
RegexpError (invalid pattern in look-behind: /((?<!estonia.*\s)\be-residence\b(?!.*estonia))/i)
app/services/word_watcher.rb:264:in `initialize'
app/services/word_watcher.rb:264:in `new'
app/services/word_watcher.rb:264:in `block in replace'
app/services/word_watcher.rb:262:in `each'
app/services/word_watcher.rb:262:in `reduce'
app/services/word_watcher.rb:262:in `replace'
app/services/word_watcher.rb:149:in `replace_link'
app/services/word_watcher.rb:155:in `apply_to_text'
app/models/user_profile.rb:194:in `apply_watched_words'
app/services/user_updater.rb:242:in `block in update'
app/services/user_updater.rb:197:in `update'
app/controllers/users_controller.rb:250:in `block in update'
app/controllers/application_controller.rb:748:in `json_result'
app/controllers/users_controller.rb:244:in `update'
app/controllers/application_controller.rb:420:in `block in with_resolved_locale'
app/controllers/application_controller.rb:420:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:389:in `call'
lib/middleware/gtm_script_nonce_injector.rb:10:in `call'
config/initializers/008-rack-cors.rb:24:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:233:in `call'
Backtrace:
app/services/word_watcher.rb:264:in `initialize'
app/services/word_watcher.rb:264:in `new'
app/services/word_watcher.rb:264:in `block in replace'
app/services/word_watcher.rb:262:in `each'
app/services/word_watcher.rb:262:in `reduce'
app/services/word_watcher.rb:262:in `replace'
app/services/word_watcher.rb:149:in `replace_link'
app/services/word_watcher.rb:155:in `apply_to_text'
app/models/user_profile.rb:194:in `apply_watched_words'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:400:in `block in make_lambda'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:180:in `block (2 levels) in halting_and_conditional'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:687:in `block (2 levels) in default_terminator'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:686:in `catch'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:686:in `block in default_terminator'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:181:in `block in halting_and_conditional'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:595:in `block in invoke_before'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:595:in `each'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:595:in `invoke_before'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:116:in `block in run_callbacks'
activerecord (7.0.5.1) lib/active_record/autosave_association.rb:370:in `around_save_collection_association'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:138:in `run_callbacks'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:929:in `_run_save_callbacks'
activerecord (7.0.5.1) lib/active_record/callbacks.rb:455:in `create_or_update'
activerecord (7.0.5.1) lib/active_record/timestamp.rb:126:in `create_or_update'
activerecord (7.0.5.1) lib/active_record/persistence.rb:615:in `save'
activerecord (7.0.5.1) lib/active_record/validations.rb:47:in `save'
activerecord (7.0.5.1) lib/active_record/transactions.rb:298:in `block in save'
activerecord (7.0.5.1) lib/active_record/transactions.rb:354:in `block in with_transaction_returning_status'
activerecord (7.0.5.1) lib/active_record/connection_adapters/abstract/database_statements.rb:314:in `transaction'
activerecord (7.0.5.1) lib/active_record/transactions.rb:350:in `with_transaction_returning_status'
activerecord (7.0.5.1) lib/active_record/transactions.rb:298:in `save'
activerecord (7.0.5.1) lib/active_record/suppressor.rb:50:in `save'
app/services/user_updater.rb:242:in `block in update'
activerecord (7.0.5.1) lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
activesupport (7.0.5.1) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
activesupport (7.0.5.1) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
activesupport (7.0.5.1) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
activesupport (7.0.5.1) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
activerecord (7.0.5.1) lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
activerecord (7.0.5.1) lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction'
activerecord (7.0.5.1) lib/active_record/transactions.rb:209:in `transaction'
app/services/user_updater.rb:197:in `update'
app/controllers/users_controller.rb:250:in `block in update'
app/controllers/application_controller.rb:748:in `json_result'
app/controllers/users_controller.rb:244:in `update'
actionpack (7.0.5.1) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (7.0.5.1) lib/abstract_controller/base.rb:215:in `process_action'
actionpack (7.0.5.1) lib/action_controller/metal/rendering.rb:165:in `process_action'
actionpack (7.0.5.1) lib/abstract_controller/callbacks.rb:234:in `block in process_action'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:118:in `block in run_callbacks'
app/controllers/application_controller.rb:420:in `block in with_resolved_locale'
i18n (1.14.1) lib/i18n.rb:322:in `with_locale'
app/controllers/application_controller.rb:420:in `with_resolved_locale'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:138:in `run_callbacks'
actionpack (7.0.5.1) lib/abstract_controller/callbacks.rb:233:in `process_action'
actionpack (7.0.5.1) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (7.0.5.1) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
activesupport (7.0.5.1) lib/active_support/notifications.rb:206:in `block in instrument'
activesupport (7.0.5.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (7.0.5.1) lib/active_support/notifications.rb:206:in `instrument'
actionpack (7.0.5.1) lib/action_controller/metal/instrumentation.rb:66:in `process_action'
actionpack (7.0.5.1) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
activerecord (7.0.5.1) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (7.0.5.1) lib/abstract_controller/base.rb:151:in `process'
actionview (7.0.5.1) lib/action_view/rendering.rb:39:in `process'
rack-mini-profiler (3.1.1) lib/mini_profiler/profiling_methods.rb:111:in `block in profile_method'
actionpack (7.0.5.1) lib/action_controller/metal.rb:188:in `dispatch'
actionpack (7.0.5.1) lib/action_controller/metal.rb:251:in `dispatch'
actionpack (7.0.5.1) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (7.0.5.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (7.0.5.1) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.5.1) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (7.0.5.1) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.0.5.1) lib/action_dispatch/routing/route_set.rb:852:in `call'
lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
rack (2.2.8) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.8) lib/rack/conditional_get.rb:40:in `call'
rack (2.2.8) lib/rack/head.rb:12:in `call'
actionpack (7.0.5.1) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:389:in `call'
lib/middleware/gtm_script_nonce_injector.rb:10:in `call'
config/initializers/008-rack-cors.rb:24:in `call'
rack (2.2.8) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.8) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/cookies.rb:704:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:99:in `run_callbacks'
actionpack (7.0.5.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
logster (2.12.2) lib/logster/middleware/reporter.rb:43:in `call'
railties (7.0.5.1) lib/rails/rack/logger.rb:40:in `call_app'
railties (7.0.5.1) lib/rails/rack/logger.rb:27:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/request_id.rb:26:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
rack (2.2.8) lib/rack/method_override.rb:24:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
rack (2.2.8) lib/rack/sendfile.rb:110:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
rack-mini-profiler (3.1.1) lib/mini_profiler.rb:413:in `call'
message_bus (4.3.7) lib/message_bus/rack/middleware.rb:60:in `call'
lib/middleware/request_tracker.rb:233:in `call'
railties (7.0.5.1) lib/rails/engine.rb:530:in `call'
railties (7.0.5.1) lib/rails/
Removing the regex from Watched Words > Link fixes the issue. However, that means this issue is still unresolved:
Interestingly, it seems to be browser-dependent. I get the error in Safari, but not in Chrome. When adding it in Chrome and viewing the list in Safari the error shows up there.
But I guess I can just ignore it for now.
Note that the regex is valid according to the ECMA 2018 standard, but maybe not by Ruby’s regex standard?
The regex also works as expected for posts on the forum.
1 Like