Discourse/widgets/hooks mod undefined after upstream with master

Hi there,

I recently tried an upstream merge to discourse master for a forum that hadn’t been updated since last August. The merge worked fine, but when I tried to run the server locally there were several modules that came back as undefined and caused an error when rendering the page.

Has anyone else come across this problem/does anyone have any potential solutions?


Welcome @Michael_Schwartz :slight_smile:

So we can better help you, can you answer a few questions?

  • How is the forum deployed?
  • Is it running on Docker?
  • How are you trying to run it locally?
  • Are there any custom modifications made via theme components or plugins?

Hi Justin,

It is not running on Docker. I’ve not exactly sure what you mean by how am I trying to run it locally. I cloned down our repo, merged it with discourse’s master branch to get any necessary updates. Migrated it and ran it with rails s. There are a few custom modifications/plugins that were made a year before I picked this up.

I can pinpoint to you exactly where the code is breaking.

When a module is created for ‘plugin-api’ it tries to recursively go through all of its children and create mods for them. On the third child ‘discourse/widgets/post-cooked’, it is fed into this line (line 122) of discourse-loader.

“reified[i] = requireFrom(resolve(dep, name), name);” is called.

when it runs registry[name] it receives an undefined and throws the error crashing the loader.

It seems clear that every single child that contains ‘widgets’ for plugin-api is not included in the registry object and therefore will crash the loader. I’ve tried moving these module names into the ‘Moved_Module’ object at the top of the page and that did not work either.

If you have any ideas, please let me know. Been at this all day.

Can anyone help here?

So if I’m understanding correctly is you just tried to upgrade a production running instance and are now running into these issues? Have you tried migrating the Rails database using rake db:migrate?

How was this production instance installed? We may not be able to help if it wasn’t installed via a supported method.

1 Like

The discourse we merged with the upstream master branch was a production instance. However, the code in our production instance was a little outdated since we hadn’t merged with Discourse upstream master branch since August of last year.

Step 1) Cloned down discourse from this repo https://github.com/correlation-one/discourse

Step 2) Used the method in this link from Sophie for merging with upstream branch https://meta.discourse.org/t/what-is-a-good-development-strategy-for-working-on-a-fork-of-discourse-privately-on-github/2664

Step 3) rake db:create and rake db:migrate

Step 4) ran a rake admin:create to have access to the forum as an admin

Step 5) ran rails s and started getting those errors.

That is all I have done. Is there any customer service rep that might be able to hop on the phone with me to talk through this? If not, please let me know if you have any thoughts on how to fix.

You’re not currently anyone’s customer.

You really don’t want to be on a fork.

It sounds like you’ll need to hire someone to convert your fork into plugins. You can post in #marketplace with a description of what changes you’ve made and your budget. You’ve given little description about the changes you’ve made, so it could be an easier job than I imagine, but a wild guess is $2000 to $5000.