Same for me, and I upgraded today. So it is in Discourse?
And now I try dig in a bit deeper.
Hmm yours is a server side error @Jagster I think that’s a different thing. Also, this change is not merged yet so it shouldn’t affect self hosted sites.
That’s true, but I was logged in.OP’s error is for anons. And anyway, in both cases it happends to categories.
From Discourse:
HasCustomFields::NotPreloadedError (Attempted to access the non preloaded custom field 'sort_topics_by_event_start_date' on the 'Category' class.
And
Message
HasCustomFields::NotPreloadedError (Attempted to access the non preloaded custom field 'sort_topics_by_event_start_date' on the 'Category' class. This is disallowed to prevent N+1 queries.)
app/models/concerns/has_custom_fields.rb:203:in `[]'
(eval):47:in `_fast_attributes'
lib/freedom_patches/ams_include_without_root.rb:57:in `include!'
lib/freedom_patches/ams_include_without_root.rb:57:in `include!'
app/controllers/application_controller.rb:531:in `serialize_data'
app/controllers/application_controller.rb:540:in `render_serialized'
app/controllers/categories_controller.rb:408:in `categories_and_topics'
app/controllers/categories_controller.rb:99:in `categories_and_latest'
app/controllers/application_controller.rb:422:in `block in with_resolved_locale'
app/controllers/application_controller.rb:422:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:64: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/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/models/concerns/has_custom_fields.rb:203:in `[]'
plugins/discourse-calendar/plugin.rb:88:in `block (2 levels) in activate!'
(eval):47:in `_fast_attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:456:in `attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:480:in `_serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:359:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer/associations.rb:124:in `block in serialize'
active_model_serializers (0.8.4) lib/active_model/serializer/associations.rb:123:in `map'
active_model_serializers (0.8.4) lib/active_model/serializer/associations.rb:123:in `serialize'
lib/freedom_patches/ams_include_without_root.rb:57:in `include!'
So… next I will kill the calender plugin, right?
edit
Links to categories on the sidebar works nicely, every other category-links gives error.
I have limited this error a bit. It happends only when a category has sub-categories. And /categories
gives error 500 too.
And I still aren’t sure if it comes from Calender. If yes is it another case where safe-mode is toothless?
But Lockdown gives this:
Message
HasCustomFields::NotPreloadedError (Attempted to access the non preloaded custom field 'redirect_url' on the 'Category' class. This is disallowed to prevent N+1 queries.)
app/models/concerns/has_custom_fields.rb:203:in `[]'
(eval):49:in `_fast_attributes'
lib/freedom_patches/ams_include_without_root.rb:57:in `include!'
lib/freedom_patches/ams_include_without_root.rb:57:in `include!'
app/controllers/application_controller.rb:531:in `serialize_data'
app/controllers/application_controller.rb:540:in `render_serialized'
app/controllers/categories_controller.rb:408:in `categories_and_topics'
app/controllers/categories_controller.rb:99:in `categories_and_latest'
app/controllers/application_controller.rb:422:in `block in with_resolved_locale'
app/controllers/application_controller.rb:422:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:64: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/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/models/concerns/has_custom_fields.rb:203:in `[]'
plugins/discourse-category-lockdown/plugin.rb:18:in `block (2 levels) in activate!'
(eval):49:in `_fast_attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:468:in `rescue in attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:455:in `attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:480:in `_serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:359:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer/associations.rb:124:in `block in serialize'
active_model_serializers (0.8.4) lib/active_model/serializer/associations.rb:123:in `map'
active_model_serializers (0.8.4) lib/active_model/serializer/associations.rb:123:in `serialize'
Env
HTTP HOSTS: foorumi.katiska.eu
So I’m quite sure this doesn’t come from plugins but Discourse itself, but again, I’m not a dev.
I’m the OP and I don’t have the Calendar plugin installed (I’m on a hosted discourse level that doesn’t have that plugin.)
It’s possible that the “sub-categories cause it” is the case… I can’t tell now since things are pretty broken on my site. But I did just create a category… so if (i forget how it works) it defaults to putting new categories under, for example, Public… then I did just create my first sub-category (accidentally).
The error certainly looks like it does… sort_topics_by_event_start_date
…
This is being registered here:
and for categories here:
I have a feeling this might be a regression due to category scalability work we are doing now… we will have a look.
Ah nice! It was already reported. I’ll leave this below so the search works better.
while trying to load /categories.json)
We are investigating this.
This problem was caused by discourse-calendar, but the latest version (soon) of the plugin should fix it:
This is a problem from discourse-category-lockdown, that we do not have any control over. I can submit a PR to it though.
Further issue tracking here non preloaded custom field - Discourse Category Lockdown - Coöperative
Caused? So, both plugins got same bug for reason X, or Discouse has changed something that affect both?
No, I’m not blaiming anyone, but I’m just trying understand jargon.
A recent performance improvement caused this. Custom fields are a unicorn in our codebase that can be used by various plugins to extend functionality. However, if unused incorrectly it can come with a performance hit. This improvement looks at addressing that:
I have submitted a PR for that one here, but it is not a repository we have access to:
I saw it got merged, I did a rebuild and it fixed the issue Thanks for the quick fix, as always fast.
Yup. Works nicely. Thanks a lot.
Category Lockdown gives spinner of eternity, though (well, that issue may come from Firefox/iPad on por…spy mode too). But it is different issue, I reckon.