Defect #37394
openuninitialized constant Redmine::WikiFormatting::CommonMark::HTML (NameError)
0%
Description
There appears to exist a loading issue, probably connected to the Zeitwerk loader, which has now been reported twice in the forums:
1.
2.
The exception raised in both the reports is "uninitialized constant Redmine::WikiFormatting::CommonMark::HTML (NameError)
".
It gets triggered by source:/tags/5.0.2/lib/redmine/wiki_formatting/common_mark/external_links_filter.rb#L27.
I don't know if this can be reproduced and if so how, but I thought that given that it is the same exception in both the reports, it might be something that has to be investigated and fixed if necessary.
Files
Updated by Azamat Hackimov almost 3 years ago
I think problem is that in Gemfile common_mark group described as optional, but really it can't be disabled, so effectively you have to install all gems for common_mark group in order to launch Redmine 5.
Updated by Joachim Mathes over 1 year ago
I can confirm that behavior.
My local development environment works fine. But when I try to run Redmine in a bitnami/ruby container, it fails with a corresponding error regarding a plugin. Even when I remove all plugins Redmine fails with/lib/redmine/wiki_formatting/markdown/formatter.rb:25:in `<module:Markdown>': uninitialized constant Redmine::WikiFormatting::Markdown::Redcarpet (NameError)
despite
- the same Redmine version 5.1.1
- the same Ruby version 3.2.2
- the same bundler version 2.4.19
- the same run command
bundle exec rails server --environment=development
- the same Gemfile.lock and thus the same gem versions.
- e.g. Rails 6.1.7.6
Any help is appreciated.
Edit (08.01.2024)¶
I found the error(s) and fixed them. But first of all I would like to share, that running
bundle exec rails zeitwerk:check
helped a lot to check if the error still exists. Now let's have a look at the fixes
- Obviously
uninitialized constant Redmine::WikiFormatting::Markdown::Redcarpet (NameError)
is related to Markdown. But our Dockerfile excluded markdown:
BUNDLE_WITHOUT=...:markdown:...
. Thus, removingmarkdown
from the exclude list fixed the error. - But I still had another issue with a RedmineUP plugin:
redmine_contacts
NameError: uninitialized constant CalendarsHelper (NameError) Object.const_get(camel_cased_word) ^^^^^^^^^^ Did you mean? CalendarsController /app/plugins/redmine_contacts/app/controllers/deals_controller.rb:50:in `<class:DealsController>'
Well, that one could actually be fixed easily by updating from version 4.3.7 to version 4.3.8. What you must know is, thatredmine_contacts
is namedredmine_crm
on RedmineUp's download page.
Updated by Go MAEDA 8 days ago
- File 37394.patch 37394.patch added
- Category changed from Text formatting to Gems support
- Target version set to 6.1.0
As already pointed out in this issue, Redmine fails to start if the commonmarker
gem is not installed. Although the gem is currently marked as optional in the Gemfile, it is in fact required for Redmine to run properly. Therefore, labeling `commonmarker` as optional is misleading and inappropriate.
The reason it may have been marked as optional originally could be that Markdown support, based on the `redcarpet` gem, was introduced in Redmine 2.5.0 as experimental (#15520), and redcarpet
did not work on JRuby. However, Redmine no longer supports JRuby.
Furthermore, since Redmine 5.1.0, the default text formatting has been changed to CommonMark Markdown (#34863), which depends on the `commonmarker` gem. Given this, treating `commonmarker` as optional is no longer suitable.
The attached patch updates the Gemfile to reflect that commonmarker
is a required dependency.
Updated by Go MAEDA 4 days ago
- File 37394-v2.patch 37394-v2.patch added
I have updated the patch. This version removes all Object.const_defined?(:Commonmarker)
checks because the CommonMarker gem is now mandatory.