# Why did my plugin stop working after months?

**URL:** https://meta.discourse.org/t/why-did-my-plugin-stop-working-after-months/216149
**Category:** Support
**Created:** [January 27, 2022, 12:27am UTC](https://meta.discourse.org/t/why-did-my-plugin-stop-working-after-months/216149 "2022-01-27T00:27:46Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![wilson29thid](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wilson29thid/32/173700_2.png) [@wilson29thid](https://meta.discourse.org/u/wilson29thid)
#### Post date: [January 27, 2022, 12:27am UTC](https://meta.discourse.org/t/why-did-my-plugin-stop-working-after-months/216149/1 "2022-01-27T00:27:46Z")

</div>

Hello, I wrote a [very basic plugin](https://github.com/29th/discourse-jwt-session) 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.

```plaintext
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:

```ruby
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?

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [January 30, 2022, 3:29pm UTC](https://meta.discourse.org/t/why-did-my-plugin-stop-working-after-months/216149/2 "2022-01-30T15:29:36Z")

</div>

> [@wilson29thid](#):
>
> `uninitialized constant Auth::DefaultCurrentUserProvider`

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.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 18, 2022, 1:41am UTC](https://meta.discourse.org/t/why-did-my-plugin-stop-working-after-months/216149/3 "2022-03-18T01:41:20Z")

</div>

Per:

[https://github.com/29th/discourse-jwt-session/commit/01e207bb97fea62fb739ea3023355f2c6eb3af33](https://github.com/29th/discourse-jwt-session/commit/01e207bb97fea62fb739ea3023355f2c6eb3af33)

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

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [April 17, 2022, 1:42am UTC](https://meta.discourse.org/t/why-did-my-plugin-stop-working-after-months/216149/4 "2022-04-17T01:42:10Z")

</div>

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