# "undefined method" Error When Running uploads:migrate\_to\_s3 Rake Task

**URL:** https://meta.discourse.org/t/undefined-method-error-when-running-uploads-migrate-to-s3-rake-task/106351
**Category:** Bug
**Created:** [January 12, 2019, 11:11am UTC](https://meta.discourse.org/t/undefined-method-error-when-running-uploads-migrate-to-s3-rake-task/106351 "2019-01-12T11:11:06Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Zyniker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zyniker/32/120004_2.png) [@Zyniker](https://meta.discourse.org/u/Zyniker)
#### Post date: [January 12, 2019, 11:11am UTC](https://meta.discourse.org/t/undefined-method-error-when-running-uploads-migrate-to-s3-rake-task/106351/1 "2019-01-12T11:11:07Z")

</div>

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

```plaintext
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](https://meta.discourse.org/t/cannot-execute-the-rake-uploads-migrate-from-s3/78541)

---

<div class="post-metadata">

### Author: ![jogutu](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jogutu](https://meta.discourse.org/u/jogutu)
#### Post date: [January 15, 2019, 3:26pm UTC](https://meta.discourse.org/t/undefined-method-error-when-running-uploads-migrate-to-s3-rake-task/106351/2 "2019-01-15T15:26:27Z")

</div>

I am also facing a similar problem when trying to run uploads:migrate\_to\_s3. Any suggestions?

 ![migrate_to_s3](https://global.discourse-cdn.com/meta/original/3X/4/d/4d5fc55c77c81c1ae6ac36d2da9cb222f182440b.png)

---

<div class="post-metadata">

### Author: ![Zyniker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zyniker/32/120004_2.png) [@Zyniker](https://meta.discourse.org/u/Zyniker)
#### Post date: [January 15, 2019, 11:28pm UTC](https://meta.discourse.org/t/undefined-method-error-when-running-uploads-migrate-to-s3-rake-task/106351/3 "2019-01-15T23:28:10Z")

</div>

As best I can tell, this is a bug (probably somewhere in [this](https://github.com/discourse/discourse/blob/83a346cd6879be75e6e9312e6b9d6edee1ae2c7b/lib/tasks/uploads.rake) 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](https://meta.discourse.org/t/cannot-execute-the-rake-uploads-migrate-from-s3/78541/10), 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.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [January 16, 2019, 7:47am UTC](https://meta.discourse.org/t/undefined-method-error-when-running-uploads-migrate-to-s3-rake-task/106351/4 "2019-01-16T07:47:48Z")

</div>

@rishabh can you have a look?

---

<div class="post-metadata">

### Author: ![rishabh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rishabh/32/179446_2.png) [@rishabh](https://meta.discourse.org/u/rishabh)
#### Post date: [January 16, 2019, 11:34am UTC](https://meta.discourse.org/t/undefined-method-error-when-running-uploads-migrate-to-s3-rake-task/106351/6 "2019-01-16T11:34:52Z")

</div>

This is now fixed in:

[https://github.com/discourse/discourse/commit/60790eb006eeaf288740bbfc3cc6eaa602179c13](https://github.com/discourse/discourse/commit/60790eb006eeaf288740bbfc3cc6eaa602179c13)

Thanks for reporting, @Zyniker 👍
