Bug: uninitialized constant SiteCategorySerializer

AI-generated summary

The Bug: uninitialized constant SiteCategorySerializer is caused by recent refactoring in the voting plugin, which is no longer compatible with Discourse version 2.3.2. nicktrav encountered the error while rebuilding Discourse with the voting plugin. sam confirmed the incompatibility but stated that it can be fixed.

A temporary solution was provided by brahn by downgrading the voting plugin to a previous version. However, the issue is now fixed per sam, with changes backported to the stable branch:

I’m seeing the following when trying to re-build Discourse with the voting plugin:

NameError: uninitialized constant SiteCategorySerializer
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:283:in `const_get'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:283:in `block in constantize'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:281:in `each'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:281:in `inject'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:281:in `constantize'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/inflections.rb:68:in `constantize'
/var/www/discourse/lib/plugin/instance.rb:93:in `block in add_to_serializer'
/var/www/discourse/lib/plugin/instance.rb:699:in `reloadable_patch'
/var/www/discourse/lib/plugin/instance.rb:92:in `add_to_serializer'
/var/www/discourse/plugins/discourse-voting/plugin.rb:82:in `block (2 levels) in activate!'
/var/www/discourse/plugins/discourse-voting/plugin.rb:81:in `each'
/var/www/discourse/plugins/discourse-voting/plugin.rb:81:in `block in activate!'
/var/www/discourse/lib/plugin/instance.rb:328:in `block in notify_after_initialize'
/var/www/discourse/lib/plugin/instance.rb:326:in `each'
/var/www/discourse/lib/plugin/instance.rb:326:in `notify_after_initialize'
/var/www/discourse/config/application.rb:292:in `each'
/var/www/discourse/config/application.rb:292:in `block in <class:Application>'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'

Seems related to some recent refactoring in the plugin:

The last known “good” version I have tried with is the following:

I’m running Discourse version 2.3.2.

1 Like

So you are saying voting plugin is no longer compatible with 2.3 (stable)?

2 Likes

Very likely, we changed some internal interfaces, we should be able to make it compatible though.

2 Likes

I just hit this today upgrading stable.
In case it is helpful to anyone or someone can suggest a better way, this is my temporary solution:


hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/discourse-voting.git
          - cd discourse-voting && git reset --hard 9b4f233b9d33a946f626597aaf3863d2305b8809 && cd ..
1 Like

This is now fixed per:

https://github.com/discourse/discourse/commit/bd5fa1737d42a958bb5cda35ae5bab2464d4e084

and

https://github.com/discourse/discourse-voting/commit/d09feb47a0a10d4a3a4be262f7259cf0a268d9fd

Core change was backported to stable.

6 Likes

This topic was automatically closed after 47 hours. New replies are no longer allowed.