Project

General

Profile

NoMethodError: undefined method `to_prepare' during Upgrade (Bitnami Stack)

Added by Volker Thiemann over 3 years ago

Hi Community,

I am trying to upgrade a Bitnami Redmine Installation and I ran into a problem I don't understand. Maybe someone can help?

I am upgrading from the Bitnami+Agile Bundle

Redmine version 3.3.0.stable
Ruby version 2.1.8-p440 (2015-12-16) [i386-mingw32]
Rails version 4.2.6
Environment production
Database adapter Mysql2
Subversion 1.8.16
Git 2.7.4
Redmine plugins:
redmine_agile 1.4.1
redmine_checklists 3.1.5

I followed the instructions on https://docs.bitnami.com/general/apps/redmine-plus-agile/administration/upgrade/
I am pretty sure I did everything according to these instructions (although I had to fix some minor things, since it is a windows system)

Basically the instructions say "Install a brand new Bitnami stack, restore the Backup-Data and run Database Update".
The latest Stack is:

Redmine version 4.1.1.stable
Ruby version 2.5.8-p224 (2020-03-31) [x64-mingw32]
Rails version 5.2.4.2

The Database Upgrade

 ruby bin/rake db:migrate RAILS_ENV=production 
fails with this error:
rake aborted!

NoMethodError: undefined method `to_prepare' for ActionDispatch::Callbacks:Class

Did you mean? to_param

It is already mentioned in the issue system but in a different context I think. Does it mean that import/upgrade is broken in the newest Release or how can this be fixed?

I did some research on this and found out, that to_prepare is deprecated since Rails 2.3.8 (long before even my old version)
How can this error re-occur here? I thought maybe I have to upgrade step by step but I don't think there is a version in between that would support this to_prepare call?

I guess this is a Redmine Problem and not related to the Bitnami Stack?
Something wrong with checklists and agile plugins maybe?
If it is a problem with the update path - can you recommend upgrade steps that avoid this problem?

Thank you for your advice!

Kind regards
Volker


Replies (9)

RE: NoMethodError: undefined method `to_prepare' during Upgrade (Bitnami Stack) - Added by Volker Thiemann over 3 years ago

I managed to update to 3.4.6-7 and produced a new export there.
The next step was to try to update to 4.0.0 or 4.1.1-4 - both did not work with the same error during database upgrade (see first post).

Can somebody explain the problem or recommend a workaround?
I don't know what to try next. Do you need any further information?

Thank you!

RE: NoMethodError: undefined method `to_prepare' during Upgrade (Bitnami Stack) - Added by Liane Hampe over 3 years ago

Hello Volker,

Are you sure that your plugins are compatible with Redmine 4.x.x?

The error looks quite familiar to me w.r.t. Redmine core patches typically made by plugins.

You can have a look in the init.rb of each plugin. Maybe there is a compatability note.

The same file could have the to_prepare method which is the reason for your error. But it could also be elsewhere. It would be helpful when you would find the code and provide a copy here.

I think I can help you when I can see the code around the critical method.

Best Regards,
Liane

RE: NoMethodError: undefined method `to_prepare' during Upgrade (Bitnami Stack) - Added by Volker Thiemann over 3 years ago

Hello Liane,

I think you are on to something. Great - thank you!

I found this in the init.rb of my Agile Plugin (backed up files):

# This file is a part of Redmin Agile (redmine_agile) plugin,
# Agile board plugin for redmine
[...]
require 'redmine'

AGILE_VERSION_NUMBER = '1.4.1'
AGILE_VERSION_TYPE = "Light version" 
[...]
ActionDispatch::Callbacks.to_prepare do
  require 'redmine_agile'
end

Agile should be compatible - but I am probably doing something wrong in the upgrade process.
As mentioned above I am trying to migrate to a new Bitnami-Stack Redmine+Agile.
So the Installation already contains Agile.
The Update procedure says I should copy my old /opt/bitnami/apps/redmine/htdocs/plugins and then install them. That seems like there could be a problem...
On the other hand the error happens before I get to the Plugin-Installation.
...but I have already copied the Plugins folder...
What do you recommend? Run the DB upgrade without copying any of the plugin data - and then?
Is the DB upgrade sufficient or do I have to copy something from my old plugin folder?

Best Regards,
Volker

RE: NoMethodError: undefined method `to_prepare' during Upgrade (Bitnami Stack) - Added by Liane Hampe over 3 years ago

Hello Volker,

I would recommend you to try first a little code hack. Use

ActiveSupport::Reloader.to_prepare

instead of

ActionDispatch::Callbacks.to_prepare

because the later is deprecated (https://apidock.com/rails/ActionDispatch/Callbacks/to_prepare/class).
since Rails v5.0.0.1.

If it fixes your problem you should contact the plugin author and ask for an update.

If you will continue to have problems, let me know.

Best Regards,
Liane

RE: NoMethodError: undefined method `to_prepare' during Upgrade (Bitnami Stack) - Added by Volker Thiemann over 3 years ago

Hi Liane,

I am trying to upgrade "redmine_checklists 3.1.5"
This Plugin is available for Version 4.x

I am wondering if i should
a) Follow the Bitnami-Upgrade Instructions
Copy the old plugin to the new installation and run an update.
This causes the problem.
-> now i could try it with your fix

Or
b) Is it better to upgrade to 4.x and re-install the new version of the plugin
I tested that yesterday and it seemed to work on my test installtion - I couldn't find a problem.

Which way is better/safer in this situation?

Thanks again for your help!

Best Regards,
Volker

RE: NoMethodError: undefined method `to_prepare' during Upgrade (Bitnami Stack) - Added by Liane Hampe over 3 years ago

Hi Volker,

When you have a higher version of a plugin you should always use the higher version as long as it is compatible with the Redmine you run or will run. This is best answered by the plugin author or somebody else able to read the code.

When you have a dump of your database, and all the files you uploaded typically into the directory files right below Redmine's root directory, and any other data what is added by you in anyway, then, there should nothing happen what cannot be fixed from my point of view.

Trying my fix is considered as temporary solution. Moreover, fixing one error does not mean that there won't be another error right away. Sometimes it is an error chain which seems never-ending. It depends how old the plugin is.

Best Regards,
Liane

P.S. How about redmine_agile, is it running now?

RE: NoMethodError: undefined method `to_prepare' during Upgrade (Bitnami Stack) - Added by Volker Thiemann over 3 years ago

Liane Hampe wrote:

Hi Volker,

When you have a higher version of a plugin you should always use the higher version as long as it is compatible with the Redmine you run or will run. This is best answered by the plugin author or somebody else able to read the code.

When you have a dump of your database, and all the files you uploaded typically into the directory files right below Redmine's root directory, and any other data what is added by you in anyway, then, there should nothing happen what cannot be fixed from my point of view.

Trying my fix is considered as temporary solution. Moreover, fixing one error does not mean that there won't be another error right away. Sometimes it is an error chain which seems never-ending. It depends how old the plugin is.

Best Regards,
Liane

P.S. How about redmine_agile, is it running now?

Hi Liane,

sorry, for not answering earlier.
As far as I can tell Redmine+Agile is running now. I am going to install a clean test environment for the users to check that out (I am not a redmine user so it is hard to tell for me).

The problem was that I accidently copied the extension files before the regular database migration. This caused the problem.

My upgrade steps are now:
1) Fresh Bitnami Installation Redmine+Agile (latest)
2) Migrate old database
3) Install latest checklist_plugin
4) Let the users test it
5) Re-Do in production

Looking good so far.

Thanks again for your support!

Best Regards,
Volker

RE: NoMethodError: undefined method `to_prepare' during Upgrade (Bitnami Stack) - Added by Liane Hampe over 3 years ago

Hi Volker,

Thank you for your feedback and sharing your upgrade steps. I am sure this is of value for others!

I hope your users will be happy now.

Best Regards,
Liane

RE: NoMethodError: undefined method `to_prepare' during Upgrade (Bitnami Stack) - Added by Dimitar (RedmineUP) over 1 year ago

Dear Volker,

This is Dimitar from the RedmineUP Support Team.

We highly appreciate the effort you put for finding the solution as well as your feedback. Glad to know that the plugin is running as expected now. :)

However, if any other questions or problems arise, please don't hesitate to contact us at . Thanks.

Volker Thiemann wrote:

Liane Hampe wrote:

Hi Volker,

When you have a higher version of a plugin you should always use the higher version as long as it is compatible with the Redmine you run or will run. This is best answered by the plugin author or somebody else able to read the code.

When you have a dump of your database, and all the files you uploaded typically into the directory files right below Redmine's root directory, and any other data what is added by you in anyway, then, there should nothing happen what cannot be fixed from my point of view.

Trying my fix is considered as temporary solution. Moreover, fixing one error does not mean that there won't be another error right away. Sometimes it is an error chain which seems never-ending. It depends how old the plugin is.

Best Regards,
Liane

P.S. How about redmine_agile, is it running now?

Hi Liane,

sorry, for not answering earlier.
As far as I can tell Redmine+Agile is running now. I am going to install a clean test environment for the users to check that out (I am not a redmine user so it is hard to tell for me).

The problem was that I accidently copied the extension files before the regular database migration. This caused the problem.

My upgrade steps are now:
1) Fresh Bitnami Installation Redmine+Agile (latest)
2) Migrate old database
3) Install latest checklist_plugin
4) Let the users test it
5) Re-Do in production

Looking good so far.

Thanks again for your support!

Best Regards,
Volker

    (1-9/9)