Hi Discourse Team,
Thank you for providing such a fantastic product! My community and I have enjoyed using it for years. Recently, we encountered an issue, and I would greatly appreciate any assistance.
After upgrading from Discourse 3.3.0 to 3.4.0, new users are seeing a blank page (header and footer only) when clicking the email verification link to reach the “activate-account” page.
(test link will provide in the end of this article)
Steps Taken So Far:
Checked Developer Console : Error indicates CSP blocking external scripts.
Tried Modifying CSP through Cloudflare :
Adjusted the policy and cleared the cache, but it didn’t resolve the issue.
Tried Modifying CSP through Discourse Admin Panel : Added ‘self’, ‘unsafe-eval’, and attempted SHA256 hashing. We also referenced this article but saw no change.
error message:
Tried various inputs (e.g., ‘self’, ‘unsafe-eval’) and even set the policy to “report only” mode. Still, no effect.
Cleared Cache : No change.
Rebuild the App : Rebuild Discourse and cleared the cache afterward, but the issue persists.
Interestingly, this problem doesn’t affect every new user. We found that around 90% of our new users face this issue.
Any suggestions or solutions would be greatly appreciated! Thank you!
@pfaffman
Just tried and saw this:
simon
September 21, 2024, 8:35pm
4
There is another site reporting CSP errors related to the /cdn-cgi/speculation
endpoint: Refused to load the script 'xxxx.com/cdn-cgi/speculation' because it violates the following Content Security Policy directive - #2 by simon . I am not aware of similar issues that have been reported in the past. Maybe something has changed either on Cloudflare or in Discourse 3.4.0.
The /cdn-cgi/speculation
endpoint is added to domains registered on Cloudflare when the “Speed Brain” feature is enabled. Speed Brain is intended to speed up a website’s performance by allowing Cloudflare to prefetch content when a user hovers over a link. I’m not sure this is compatible with Discourse.
I see the Speculation-Rules
header is being returned with the response when I visit https://community.lezismore.org/login
. That indicates that the Speed Brain feature is enabled. From the Cloudflare docs, it seems that it is enabled by default.
Can you try disabling Speed Brain from the Speed tab of your Cloudflare dashboard? Instructions for how to do that are here: Speed Brain | Cloudflare Speed docs .
The “Caveats” section of the docs I linked to says:
Speed Brain will not work with restrictive Content Security Policy configurations using strict-dynamic
or nonce-{hash}
attributes.
If Speed Brain is compatible with Discourse, we’ll have to figure out how to add it to the Content Security rules.
3 Likes
Thank you for your response.
I have already disabled the Speed Brain setting in Cloudflare and cleared the cache as suggested, but unfortunately, the issue persists.
Here’s the link to today’s new testing active account page, for anyone who’s interested: https://community.lezismore.org/users/activate-account/34180b9eed9e1a1a1dbcca7eab66fb43
simon
September 22, 2024, 8:27am
6
Are you able to login to the site? If so, do you see any error messages on its error logs page (https://community.lezismore.org/logs )?
1 Like
Yes I can login in the website.
Here is the log page:
Job exception: can't write unknown attribute
and the details are following:
Message (23685 copies reported)
Job exception: can't write unknown attribute ``
Backtrace
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activemodel-7.1.4/lib/active_model/attribute.rb:236:in `with_value_from_database'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activemodel-7.1.4/lib/active_model/attribute_set.rb:60:in `write_from_user'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/transactions.rb:435:in `restore_transaction_record_state'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/transactions.rb:345:in `rolledback!'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:200:in `block in rollback_records'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:263:in `run_action_on_records'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:199:in `rollback_records'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:527:in `block in rollback_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-7.1.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:520:in `rollback_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:539:in `rescue in block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:538:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-7.1.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:532:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:344:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/transactions.rb:361:in `with_transaction_returning_status'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/persistence.rb:904:in `update!'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_scheduler-0.17.0/lib/mini_scheduler/manager.rb:156:in `process_queue'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_scheduler-0.17.0/lib/mini_scheduler/manager.rb:77:in `worker_loop'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_scheduler-0.17.0/lib/mini_scheduler/manager.rb:63:in `block (2 levels) in ensure_worker_threads'
1 Like
There are some other errors that I’m not sure are relevant, but I’m providing them anyway for reference, just in case.
Message
Job exception: PG::SyntaxError: ERROR: zero-length delimited identifier at or near """"
LINE 1: ...1506385, "success" = TRUE WHERE "scheduler_stats"."" IS NULL
^
Backtrace
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.3.0/lib/patches/db/pg.rb:69:in `exec_params'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.3.0/lib/patches/db/pg.rb:69:in `exec_params'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `block (2 levels) in exec_no_cache'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/dependencies/interlock.rb:41:in `permit_concurrent_loads'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:767:in `block in exec_no_cache'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract_adapter.rb:752:in `block in log'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract_adapter.rb:743:in `log'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:766:in `exec_no_cache'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:745:in `execute_and_clear'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:67:in `exec_delete'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/database_statements.rb:175:in `update'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/query_cache.rb:22:in `update'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/persistence.rb:513:in `_update_record'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/persistence.rb:1060:in `_update_row'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/locking/optimistic.rb:93:in `_update_row'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/persistence.rb:1082:in `_update_record'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/attribute_methods/dirty.rb:216:in `_update_record'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/callbacks.rb:463:in `block in _update_record'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/callbacks.rb:99:in `run_callbacks'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/callbacks.rb:929:in `_run_update_callbacks'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/callbacks.rb:463:in `_update_record'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/timestamp.rb:121:in `_update_record'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/persistence.rb:1069:in `create_or_update'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/callbacks.rb:455:in `block in create_or_update'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/callbacks.rb:99:in `run_callbacks'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/callbacks.rb:929:in `_run_save_callbacks'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/callbacks.rb:455:in `create_or_update'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/timestamp.rb:126:in `create_or_update'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/persistence.rb:648:in `save!'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/validations.rb:53:in `save!'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/transactions.rb:302:in `block in save!'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/transactions.rb:354:in `block in with_transaction_returning_status'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/database_statements.rb:314:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/transactions.rb:350:in `with_transaction_returning_status'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/transactions.rb:302:in `save!'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/suppressor.rb:54:in `save!'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/persistence.rb:782:in `block in update!'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/transactions.rb:354:in `block in with_transaction_returning_status'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/transactions.rb:350:in `with_transaction_returning_status'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/persistence.rb:780:in `update!'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/mini_scheduler-0.16.0/lib/mini_scheduler/manager.rb:134:in `process_queue'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/mini_scheduler-0.16.0/lib/mini_scheduler/manager.rb:70:in `worker_loop'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/mini_scheduler-0.16.0/lib/mini_scheduler/manager.rb:59:in `block (2 levels) in ensure_worker_threads'
A big thanks to anyone willing to help
1 Like
simon
September 23, 2024, 6:22am
9
Looking at the details you provided, it’s not clear to me where in the Discourse code the error is being triggered. Are there any details in the “info” or “env” tabs on the error page? There’s also a “share” button on the bottom right of the page that will display all error details.
I’m not certain the error is related to the issue, but it seems that something’s going wrong with background jobs (sidekiq) on your site.
There might also be useful information on your site’s /sidekiq
page. As an admin user, you can view it at https://community.lezismore.org/sidekiq
3 Likes
th21
September 23, 2024, 4:48pm
10
I checked your website and it’s in traditional Chinese, maybe you run into the same situation as I did
3 Likes
It seems we were facing the same issue! After I updated the activation page link in the email template from:
%{base_url}/user/activate-account/%{email_token}
to:
%{base_url}/u/activate-account/%{email_token}
everything started working fine. The issue likely occurred because the email template didn’t update automatically due to my previous customizations, which prevented changes from being applied after rebuilding the app.
A big thanks to @simon for the incredible patience in helping me through debug, and to @th21 for the information!
I will continue monitoring the application’s performance and will share updates if any issues arise. Once again, thank you guys!
3 Likes
system
(system)
Closed
October 24, 2024, 5:52pm
12
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.