# Trouble with \`rake db:migrate\` and AWS S3

**URL:** <https://meta.discourse.org/t/trouble-with-rake-db-migrate-and-aws-s3/24318>\
**Category:** Self-hosting\
**Created:** [22 Enero, 2015 16:52 UTC](https://meta.discourse.org/t/trouble-with-rake-db-migrate-and-aws-s3/24318 "2015-01-22T16:52:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kinosang](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kinosang/32/122436_2.png) [@kinosang](https://meta.discourse.org/u/kinosang)\
**Post date:** [22 Enero, 2015 16:52 UTC](https://meta.discourse.org/t/trouble-with-rake-db-migrate-and-aws-s3/24318/1 "2015-01-22T16:52:17Z")

</div>

**Update 2015-01-26 06:55 UTC : `rake db:migrate` works well now, this problem is caused by invalid format strings in yaml file.**

I’ve already check my database connection information again and again, but it still return:

```
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
I, [2015-01-22T16:48:54.272049 #41] INFO -- : gem install omniauth-qq -v 0.3.0 -i /var/www/discourse/plugins/qq_connect/gems/2.0.0 --no-document --ignore-dependencies
Successfully installed omniauth-qq-0.3.0
1 gem installed
gem install omniauth-weibo-oauth2 -v 0.4.0 -i /var/www/discourse/plugins/weibo-login/gems/2.0.0 --no-document --ignore-dependencies
Successfully installed omniauth-weibo-oauth2-0.4.0
1 gem installed

FAILED
--------------------
RuntimeError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 5678 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:105:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --verbose --without test --without development'", "su discourse -c 'bundle exec rake db:migrate'", "su discourse -c 'bundle exec rake assets:precompile'"]}
f86048f46d73adda6552bf9f6512842c051fbf6b7aa87cbe47e667c28817ab60
FAILED TO BOOTSTRAP

```

---

<div class="post-metadata">

**Author:** ![kinosang](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kinosang/32/122436_2.png) [@kinosang](https://meta.discourse.org/u/kinosang)\
**Post date:** [25 Enero, 2015 04:43 UTC](https://meta.discourse.org/t/trouble-with-rake-db-migrate-and-aws-s3/24318/2 "2015-01-25T04:43:50Z")

</div>

Is there anyone can help me?

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [25 Enero, 2015 11:42 UTC](https://meta.discourse.org/t/trouble-with-rake-db-migrate-and-aws-s3/24318/3 "2015-01-25T11:42:05Z")

</div>

Yeah, please remove all plugins and try again. I suspect you have an incompatible plugin.

---

<div class="post-metadata">

**Author:** ![kinosang](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kinosang/32/122436_2.png) [@kinosang](https://meta.discourse.org/u/kinosang)\
**Post date:** [25 Enero, 2015 12:25 UTC](https://meta.discourse.org/t/trouble-with-rake-db-migrate-and-aws-s3/24318/4 "2015-01-25T12:25:29Z")

</div>

But it works well on `standalone`

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [25 Enero, 2015 12:51 UTC](https://meta.discourse.org/t/trouble-with-rake-db-migrate-and-aws-s3/24318/5 "2015-01-25T12:51:18Z")

</div>

Which multisite guide are you using, I nuked an old one

---

<div class="post-metadata">

**Author:** ![kinosang](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kinosang/32/122436_2.png) [@kinosang](https://meta.discourse.org/u/kinosang)\
**Post date:** [25 Enero, 2015 13:15 UTC](https://meta.discourse.org/t/trouble-with-rake-db-migrate-and-aws-s3/24318/6 "2015-01-25T13:15:04Z")

</div>

Just follow up the `sample/web_only.yml`, not use any guide.

---

<div class="post-metadata">

**Author:** ![kinosang](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kinosang/32/122436_2.png) [@kinosang](https://meta.discourse.org/u/kinosang)\
**Post date:** [25 Enero, 2015 19:06 UTC](https://meta.discourse.org/t/trouble-with-rake-db-migrate-and-aws-s3/24318/7 "2015-01-25T19:06:37Z")

</div>

**Update 2015-01-25 19:40 UTC : AWS S3 works well now, just grant full access to the IAM user for S3.**

And for AWS S3, users can’t upload any files with my setting, I’ve already tried both of IAM key and Root key.

It returned ( get from log/production.log ):

```
Started POST "/uploads" for 205.251.211.116 at 2015-01-25 18:54:25 +0000
Processing by UploadsController#create as JSON
  Parameters: {"files"=>[#<ActionDispatch::Http::UploadedFile:0x0000000b275e10 @tempfile=#<Tempfile:/tmp/RackMultipart20150125-1151-y6gttn>, @original_filename="123.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"files[]\"; filename=\"123.jpg\"\r\nContent-Type: image/jpeg\r\n">]}
Completed 500 Internal Server Error in 1104ms

NoMethodError (undefined method `captures' for nil:NilClass):
  lib/s3_helper.rb:74:in `get_or_create_directory'
  lib/s3_helper.rb:25:in `upload'
  lib/file_store/s3_store.rb:89:in `store_file'
  lib/file_store/s3_store.rb:15:in `store_upload'
  app/models/upload.rb:112:in `create_for'
  app/controllers/uploads_controller.rb:9:in `create'
  lib/middleware/anonymous_cache.rb:119:in `call'
  config/initializers/quiet_logger.rb:10:in `call_with_quiet_assets'
  config/initializers/silence_logger.rb:26:in `call'

```
