Why did my plugin stop working after months?

Hello, I wrote a very basic plugin that adds a JWT token after a user logs in, and it’s been working fine for nearly a year. Today our forum went down because somehow the cert expired (which is curious in itself), so I tried a ./launcher app rebuild, and the rebuild fails due to an error on the plugin.

I, [2022-01-27T00:16:48.616458 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
** PLUGIN FAILURE **

You are unable to build Discourse due to this error during plugin
initialization:

uninitialized constant Auth::DefaultCurrentUserProvider

/var/www/discourse/plugins/discourse-jwt-session/lib/jwt_current_user_provider.rb:3:in `<main>'

The relevant line in the plugin is just:

class JwtCurrentUserProvider < Auth::DefaultCurrentUserProvider

I can’t imagine why this would suddenly stop working, as there don’t appear to be any relevant changes to lib/auth/current_user_provider.rb so that constant should very much still exist. Unless there was a change to the order in which libraries and plugins are loaded?

Commenting out the plugin in my app.yaml allows rebuild to complete successfully. Uncommenting it makes it fail again.

For context, we’re running on version 2.8.0beta4. Any idea what might be going on all of a sudden?

I just found this topic while looking for a solution for the same issue, and in the meanwhile I have found a solution.

The include for the class definitiion should now be within the after_initialize block, otherwise it does not work anymore.

2 Likes

Per:

I am confirming that your fix appears to be what sorted it for @wilson29thid :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.