ruby on rails - AWS/Heroku Errors out when uploading files -


so, have rails/react application deployed heroku. works minus uploading feature. switched on local storage aws (carrierwave/fog) errors out when put request sent uploading. here have...

2017-07-26t00:15:26.403722+00:00 app[web.1]: [d2e717f7-5bc0-4832-a441-0f382dffc6c7]    (3.9ms)  begin 2017-07-26t00:15:26.409753+00:00 app[web.1]: [d2e717f7-5bc0-4832-a441-0f382dffc6c7]   sql (3.3ms)  insert "photos" ("user_id", "created_at", "updated_at", "photos") values ($1, $2, $3, $4) returning "id"  [["user_id", 4], ["created_at", "2017-07-26 00:15:26.404361"], ["updated_at", "2017-07-26 00:15:26.404361"], ["photos", "[\"15740973_10211933753000319_7147015776553812508_n.jpg\"]"]] 2017-07-26t00:15:27.103871+00:00 heroku[router]: at=info method=post path="/photos" host=www.--my-domain-name--.com request_id=d2e717f7-5bc0-4832-a441-0f382dffc6c7 fwd="76.118.245.207" dyno=web.1 connect=1ms service=3593ms status=500 bytes=1827 protocol=http 2017-07-26t00:15:27.099506+00:00 app[web.1]: [d2e717f7-5bc0-4832-a441-0f382dffc6c7]    (5.3ms)  rollback 2017-07-26t00:15:27.100107+00:00 app[web.1]: [d2e717f7-5bc0-4832-a441-0f382dffc6c7] completed 500 internal server error in 3404ms (activerecord: 13.3ms) 2017-07-26t00:15:27.101564+00:00 app[web.1]: [d2e717f7-5bc0-4832-a441-0f382dffc6c7] 2017-07-26t00:15:27.101609+00:00 app[web.1]: [d2e717f7-5bc0-4832-a441-0f382dffc6c7] excon::error::forbidden (expected(200) <=> actual(403 forbidden) 2017-07-26t00:15:27.101611+00:00 app[web.1]: excon.error.response 2017-07-26t00:15:27.101625+00:00 app[web.1]:   :body          => "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<error><code>accessdenied</code><message>access denied</message><requestid>70d9e2369be5d8a0</requestid><hostid>qfx1z2eqsp+/mt9j+uompgs2z4rrfndb1zqmj6bfs+ijy8ouei56xlxem8kaowvk276daukgryg=</hostid></error>" 2017-07-26t00:15:27.101626+00:00 app[web.1]:   :cookies       => [ 2017-07-26t00:15:27.101627+00:00 app[web.1]:   ] 2017-07-26t00:15:27.101628+00:00 app[web.1]:   :headers       => { 2017-07-26t00:15:27.101629+00:00 app[web.1]:     "connection"       => "close" 2017-07-26t00:15:27.101630+00:00 app[web.1]:     "content-type"     => "application/xml" 2017-07-26t00:15:27.101631+00:00 app[web.1]:     "date"             => "wed, 26 jul 2017 00:15:26 gmt" 2017-07-26t00:15:27.101632+00:00 app[web.1]:     "x-amz-id-2"       => "qfx1z2eqsp+/mt9j+uompgs2z4rrfndb1zqmj6bfs+ijy8ouei56xlxem8kaowvk276daukgryg=" 2017-07-26t00:15:27.101634+00:00 app[web.1]:   } 2017-07-26t00:15:27.101631+00:00 app[web.1]:     "server"           => "amazons3" 2017-07-26t00:15:27.101633+00:00 app[web.1]:     "x-amz-request-id" => "70d9e2369be5d8a0" 2017-07-26t00:15:27.101635+00:00 app[web.1]:   :host          => "my-bucket-name-production.s3-us-east-2.amazonaws.com" 2017-07-26t00:15:27.101636+00:00 app[web.1]:   :local_address => "172.16.75.138" 2017-07-26t00:15:27.101636+00:00 app[web.1]:   :local_port    => 50501 2017-07-26t00:15:27.101637+00:00 app[web.1]:   :path          => "/uploads/photo/photos/20/15740973_10211933753000319_7147015776553812508_n.jpg" 2017-07-26t00:15:27.101638+00:00 app[web.1]:   :port          => 443 2017-07-26t00:15:27.101638+00:00 app[web.1]:   :reason_phrase => "forbidden" 2017-07-26t00:15:27.101639+00:00 app[web.1]:   :remote_ip     => "52.219.80.56" 2017-07-26t00:15:27.101640+00:00 app[web.1]:   :status        => 403 2017-07-26t00:15:27.101640+00:00 app[web.1]:   :status_line   => "http/1.1 403 forbidden\r\n" 2017-07-26t00:15:27.101641+00:00 app[web.1]: ): 2017-07-26t00:15:27.101673+00:00 app[web.1]: [d2e717f7-5bc0-4832-a441-0f382dffc6c7] 2017-07-26t00:15:27.101718+00:00 app[web.1]: [d2e717f7-5bc0-4832-a441-0f382dffc6c7] app/controllers/photos_controller.rb:36:in `create' 

.env file

aws_access_key_id     = retracted aws_secret_access_key = retracted s3_bucket             = retracted 

carrierwave.rb file. located in config/initializers/carrierwave.rb

require 'carrierwave/orm/activerecord'  carrierwave.configure |config|   if !rails.env.test?     config.fog_credentials = {       provider: "aws",       aws_access_key_id: env["aws_access_key_id"],       aws_secret_access_key: env["aws_secret_access_key"],       :region => 'us-east-2'     }     config.fog_directory  = env["s3_bucket"]   end end 

my uploader file, photos_uploader.rb

class photosuploader < carrierwave::uploader::base    ...    # choose kind of storage use uploader:     if rails.env.test?       storage :file     else       storage :fog     end    ... 

i have used method on previous project , had no issues. different between 2 on other 1 used built in heroku domain name. on one, purchased own domain name , set dns pointed heroku. thinking, possibly messing things up, out of ideas @ point.

running, heroku run rails c , photo.all confirms nothing saved database.

so, little embarrassed here. check spelling...

the permission had on user amazonsesfullaccess

which, of course lot different wanted - amazons3fullaccess


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -