[solved] 500 internal server error after gem update

Added by Alexandre Russo 3 months ago

After gem update i have this error :

  Current user: anonymous
  Rendering account/login.html.erb within layouts/base
  Rendered account/login.html.erb within layouts/base (31.2ms)
Completed 500 Internal Server Error in 68ms (ActiveRecord: 11.8ms)

ActionView::Template::Error (Tried to load unspecified class: Symbol):
    11: <%= favicon %>
    12: <%= stylesheet_link_tag 'jquery/jquery-ui-1.11.0', 'application', 'responsive', :media => 'all' %>
    13: <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
    14: <%= javascript_heads %>
    15: <%= heads_for_theme %>
    16: <%= call_hook :view_layouts_base_html_head %>
    17: <!-- page specific tags -->

app/models/user_preference.rb:50:in `initialize'
app/models/user.rb:952:in `pref'
app/helpers/application_helper.rb:1493:in `javascript_heads'
app/views/layouts/base.html.erb:14:in `_app_views_layouts_base_html_erb__63534369979365645_72000'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'

My Gemfile :

source 'https://rubygems.org'

#ruby '>= 2.3.0', '< 2.7.0' if Bundler::VERSION >= '1.12.0'
gem "bundler", ">= 1.5.0" 

gem "rails", "~> 5.2.2" 
gem "rouge", "~> 3.7" 
gem "request_store", "~> 1.1" 
gem "mini_mime", "~> 1.0" 
gem "actionpack-xml_parser" 
gem "roadie-rails", "~> 1.3" 
gem "mimemagic" 
gem "mail", "~> 2.7" 
gem "csv", "~> 3.0" if RUBY_VERSION >= "2.3" && RUBY_VERSION < "2.6" 

gem "nokogiri", (RUBY_VERSION >= "2.3" ? "~> 1.10" : "~> 1.9")
gem "i18n" 
gem "xpath", "< 3.2.0" if RUBY_VERSION < "2.3" 

# TODO: Remove the following line when #32223 is fixed
gem "sprockets", "~> 3.7.2" 

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :x64_mingw, :mswin]
gem "rbpdf", "~> 1.19" 

# Optional gem for LDAP authentication
group :ldap do
  gem "net-ldap", "~> 0.16" 
end

platforms :mri, :mingw, :x64_mingw do
  # Optional gem for exporting the gantt to a PNG file, not supported with jruby
  group :rmagick do
    gem "rmagick", "~> 2.16" 
  end

  # Optional Markdown support, not for JRuby
  group :markdown do
    gem "redcarpet", "~> 3.4" 
  end
end

# Include database gems for the adapters found in the database
# configuration file
require 'erb'
require 'yaml'

seen_adapters = {}
Dir['/usr/share/redmine/{config,instances/*/config}/database.yml'].select do |f|
  File.readable?(f)
end.each do |database_file|
  database_config = YAML::load(ERB.new(IO.read(database_file)).result)
  adapters = database_config.values.map {|c| c['adapter']}.compact.uniq
  if adapters.any?
    adapters.each do |adapter|
      next if seen_adapters[adapter]
      seen_adapters[adapter] = true
      case adapter
      when 'mysql2'
        gem "mysql2", "~> 0.5", :platforms => [:mri, :mingw, :x64_mingw]
      when /postgresql/
        gem "pg", "~> 1.1", :platforms => [:mri, :mingw, :x64_mingw]
      when /sqlite3/
        gem "sqlite3", "~>1.3", :platforms => [:mri, :mingw, :x64_mingw]
      when /sqlserver/
        gem "tiny_tds", "~> 2.1", :platforms => [:mri, :mingw, :x64_mingw]
        gem "activerecord-sqlserver-adapter", "~> 5.2.1", :platforms => [:mri, :mingw, :x64_mingw]
      else
        warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems")
      end
    end
  else
    warn("No adapter found in config/database.yml, please configure it first")
  end
end

# Load plugins' Gemfiles
Dir.glob File.expand_path("../plugins/*/{Gemfile,PluginGemfile}", __FILE__) do |file|
  eval_gemfile file
end

I'm on Debian with Apache

Paquet : redmine                                        
Version : 4.0.7-1~bpo10+1
cat /etc/debian_version 
11.3
ruby -v
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux-gnu]
./about 

sh: 1: svn: not found
sh: 1: hg: not found
sh: 1: cvs: not found
sh: 1: bzr: not found
Environment:
  Redmine version                4.0.7.stable
  Ruby version                   2.7.4-p191 (2021-07-07) [x86_64-linux-gnu]
  Rails version                  5.2.8.1
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Git                            2.30.2
  Filesystem                     
Redmine plugins:
  no plugin installed

Does anyone know how to solve this ?

Thank you

Replies (2)

RE: 500 internal server error after gem update - Added by Liane Hampe 3 months ago

Hi Alexandre,

Navigate into your ```config/additional_environment.rb``` and add

config.active_record.yaml_column_permitted_classes = [Symbol, ActiveSupport::HashWithIndifferentAccess]

When you do not have the file you can create it. Restart the application server afterwards.

This will solve your problem!

Best Regards,
Liane

RE: 500 internal server error after gem update - Added by Alexandre Russo 3 months ago

Thank you @Liane !

it works

(1-2/2)