"undefined method" Error When Running uploads:migrate_to_s3 Rake Task

When running the uploads:migrate_to_s3 rake task on the most-current version of Discourse, the following error results:

rake aborted!
NoMethodError: undefined method `include?' for nil:NilClass
/var/www/discourse/lib/tasks/uploads.rake:217:in `migrate_to_s3'
/var/www/discourse/lib/tasks/uploads.rake:210:in `block in migrate_to_s3_all_sites'
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rails_multisite-2.0.4/lib/rails_multisite/connection_management.rb:63:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rails_multisite-2.0.4/lib/rails_multisite/connection_management.rb:73:in `each_connection'
/var/www/discourse/lib/tasks/uploads.rake:210:in `migrate_to_s3_all_sites'
/var/www/discourse/lib/tasks/uploads.rake:206:in `block in <top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => uploads:migrate_to_s3
(See full trace by running task with --trace)

Possibly related: Cannot execute the rake uploads:migrate_from_s3

I am also facing a similar problem when trying to run uploads:migrate_to_s3. Any suggestions?

As best I can tell, this is a bug (probably somewhere in this file) that will need to be fixed before we’ll be able to run the rake task successfully. Given the interactions in the previous thread, I would assume this is something that will need the attention of @sam or @zogstrip.

I perused the file, but, sadly, I don’t know enough Ruby to find the problem.

3 Likes

@rishabh can you have a look?

2 Likes

This is now fixed in:

https://github.com/discourse/discourse/commit/60790eb006eeaf288740bbfc3cc6eaa602179c13

Thanks for reporting, @Zyniker :+1:

6 Likes