简体   繁体   中英

Can't upload an image using Ruby on rails, Paperclip, Heroku and AWS

I have been doing the One Month Rails course. In the session "Paperclip to Amazon S3 Images on Heroku" i need to upload images using Paperclip on AWS on Heroku.

I have the option to upload a photo: http://arcane-shore-2097.herokuapp.com/pins/new

But after clicking "Create Pin" i got an error:

We're sorry, but something went wrong. If you are the application owner check the logs for more information.

I have done all the steps, but something is not working correct

Here is my Github: https://github.com/frankzk/pinteresting

Heres is my Logs:

Gourmandises@GOURMANDISES-PC ~/desktop/pinteresting (master)
$ heroku logs
←[36m2014-05-28T04:22:33.975266+00:00 app[web.1]:←[0m   Rendered pins/index.html
.erb within layouts/application (13.5ms)
←[36m2014-05-28T04:22:33.978253+00:00 app[web.1]:←[0m Completed 200 OK in 19ms (
Views: 13.1ms | ActiveRecord: 4.2ms)
←[36m2014-05-28T04:22:33.958900+00:00 app[web.1]:←[0m Processing by PinsControll
er#index as HTML
←[36m2014-05-28T04:22:33.977595+00:00 app[web.1]:←[0m   Rendered layouts/_header
.html.erb (1.3ms)
←[33m2014-05-28T04:22:34.369537+00:00 heroku[router]:←[0m at=info method=GET pat
h=/images/medium/missing.png host=arcane-shore-2097.herokuapp.com request_id=d91
1e565-fb96-4048-8e97-41a702823754 fwd="190.114.248.109" dyno=web.1 connect=1ms s
ervice=87ms status=404 bytes=1829
←[33m2014-05-28T04:22:34.379829+00:00 heroku[router]:←[0m at=info method=GET pat
h=/assets/application-3d6ac658b37f1391e8e7ad14c065d776.css host=arcane-shore-209
7.herokuapp.com request_id=d6701c20-cae5-4400-a1ec-e2e8c790c6b7 fwd="190.114.248
.109" dyno=web.1 connect=1ms service=93ms status=304 bytes=133
←[33m2014-05-28T04:22:34.381667+00:00 heroku[router]:←[0m at=info method=GET pat
h=/assets/application-958ecb4fb9542c4780a50a5263b53b34.js host=arcane-shore-2097
.herokuapp.com request_id=aeb3ab9b-e47b-46b2-8e54-222a88be4e89 fwd="190.114.248.
109" dyno=web.1 connect=1ms service=97ms status=304 bytes=133
←[36m2014-05-28T04:22:34.291226+00:00 app[web.1]:←[0m Started GET "/images/mediu
m/missing.png" for 190.114.248.109 at 2014-05-28 04:22:34 +0000
←[36m2014-05-28T04:22:34.368555+00:00 app[web.1]:←[0m
←[36m2014-05-28T04:22:34.368589+00:00 app[web.1]:←[0m   vendor/ruby-2.0.0/lib/ru
by/2.0.0/webrick/server.rb:295:in `block in start_thread'
←[36m2014-05-28T04:22:34.368561+00:00 app[web.1]:←[0m ActionController::RoutingE
rror (No route matches [GET] "/images/medium/missing.png"):
←[36m2014-05-28T04:22:34.368573+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/actionpack-4.1.1/lib/action_dispatch/middleware/request_id.rb:21:in `call'

←[36m2014-05-28T04:22:34.368563+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/actionpack-4.1.1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in
`call'
←[36m2014-05-28T04:22:34.368566+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/railties-4.1.1/lib/rails/rack/logger.rb:38:in `call_app'
←[36m2014-05-28T04:22:34.368576+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
←[36m2014-05-28T04:22:34.368577+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/activesupport-4.1.1/lib/active_support/cache/strategy/local_cache_middlewa
re.rb:26:in `call'
←[36m2014-05-28T04:22:34.368580+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
←[36m2014-05-28T04:22:34.368564+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/actionpack-4.1.1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `
call'
←[36m2014-05-28T04:22:34.368588+00:00 app[web.1]:←[0m   vendor/ruby-2.0.0/lib/ru
by/2.0.0/webrick/httpserver.rb:94:in `run'
←[36m2014-05-28T04:22:34.368567+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/railties-4.1.1/lib/rails/rack/logger.rb:20:in `block in call'
←[36m2014-05-28T04:22:34.368572+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/railties-4.1.1/lib/rails/rack/logger.rb:20:in `call'
←[36m2014-05-28T04:22:34.368587+00:00 app[web.1]:←[0m   vendor/ruby-2.0.0/lib/ru
by/2.0.0/webrick/httpserver.rb:138:in `service'
←[36m2014-05-28T04:22:34.368590+00:00 app[web.1]:←[0m
←[36m2014-05-28T04:22:34.368568+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/activesupport-4.1.1/lib/active_support/tagged_logging.rb:68:in `block in t
agged'
←[36m2014-05-28T04:22:34.368571+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/activesupport-4.1.1/lib/active_support/tagged_logging.rb:68:in `tagged'
←[36m2014-05-28T04:22:34.368578+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/actionpack-4.1.1/lib/action_dispatch/middleware/static.rb:64:in `call'
←[36m2014-05-28T04:22:34.368570+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/activesupport-4.1.1/lib/active_support/tagged_logging.rb:26:in `tagged'
←[36m2014-05-28T04:22:34.368575+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
←[36m2014-05-28T04:22:34.368585+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
←[36m2014-05-28T04:22:34.368582+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/railties-4.1.1/lib/rails/application.rb:144:in `call'
←[36m2014-05-28T04:22:34.368592+00:00 app[web.1]:←[0m
←[36m2014-05-28T04:22:34.368583+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
←[36m2014-05-28T04:22:34.368581+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/railties-4.1.1/lib/rails/engine.rb:514:in `call'
←[36m2014-05-28T04:22:34.368586+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
←[33m2014-05-28T04:22:34.720225+00:00 heroku[router]:←[0m at=info method=GET pat
h=/images/medium/missing.png host=arcane-shore-2097.herokuapp.com request_id=16c
f2245-1faa-4a7d-89c0-d9c47b1fbcc1 fwd="190.114.248.109" dyno=web.1 connect=1ms s
ervice=13ms status=404 bytes=1829
←[36m2014-05-28T04:22:34.714980+00:00 app[web.1]:←[0m Started GET "/images/mediu
m/missing.png" for 190.114.248.109 at 2014-05-28 04:22:34 +0000
←[36m2014-05-28T04:22:34.719414+00:00 app[web.1]:←[0m
←[36m2014-05-28T04:22:34.719422+00:00 app[web.1]:←[0m ActionController::RoutingE
rror (No route matches [GET] "/images/medium/missing.png"):
←[36m2014-05-28T04:22:34.719424+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/actionpack-4.1.1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in
`call'
←[36m2014-05-28T04:22:34.719427+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/railties-4.1.1/lib/rails/rack/logger.rb:38:in `call_app'
←[36m2014-05-28T04:22:34.719426+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/actionpack-4.1.1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `
call'
←[36m2014-05-28T04:22:34.719429+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/railties-4.1.1/lib/rails/rack/logger.rb:20:in `block in call'
←[36m2014-05-28T04:22:34.719431+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/activesupport-4.1.1/lib/active_support/tagged_logging.rb:68:in `block in t
agged'
←[36m2014-05-28T04:22:34.719432+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/activesupport-4.1.1/lib/active_support/tagged_logging.rb:26:in `tagged'
←[36m2014-05-28T04:22:34.719434+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/activesupport-4.1.1/lib/active_support/tagged_logging.rb:68:in `tagged'
←[36m2014-05-28T04:22:34.719438+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/actionpack-4.1.1/lib/action_dispatch/middleware/request_id.rb:21:in `call'

←[36m2014-05-28T04:22:34.719436+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/railties-4.1.1/lib/rails/rack/logger.rb:20:in `call'
←[36m2014-05-28T04:22:34.719441+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
←[36m2014-05-28T04:22:34.719443+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/activesupport-4.1.1/lib/active_support/cache/strategy/local_cache_middlewa
re.rb:26:in `call'
←[36m2014-05-28T04:22:34.719439+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
←[36m2014-05-28T04:22:34.719446+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
←[36m2014-05-28T04:22:34.719444+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/actionpack-4.1.1/lib/action_dispatch/middleware/static.rb:64:in `call'
←[36m2014-05-28T04:22:34.719455+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
←[36m2014-05-28T04:22:34.719451+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
←[36m2014-05-28T04:22:34.719448+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/railties-4.1.1/lib/rails/engine.rb:514:in `call'
←[36m2014-05-28T04:22:34.719457+00:00 app[web.1]:←[0m   vendor/ruby-2.0.0/lib/ru
by/2.0.0/webrick/httpserver.rb:138:in `service'
←[36m2014-05-28T04:22:34.719460+00:00 app[web.1]:←[0m   vendor/ruby-2.0.0/lib/ru
by/2.0.0/webrick/server.rb:295:in `block in start_thread'
←[36m2014-05-28T04:22:34.719461+00:00 app[web.1]:←[0m
←[36m2014-05-28T04:22:34.719450+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/railties-4.1.1/lib/rails/application.rb:144:in `call'
←[36m2014-05-28T04:22:34.719453+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0
/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
←[36m2014-05-28T04:22:34.719463+00:00 app[web.1]:←[0m
←[36m2014-05-28T04:22:34.719458+00:00 app[web.1]:←[0m   vendor/ruby-2.0.0/lib/ru
by/2.0.0/webrick/httpserver.rb:94:in `run'
←[36m2014-05-28T04:22:36.182227+00:00 app[web.1]:←[0m Started GET "/pins/new" fo
r 190.114.248.109 at 2014-05-28 04:22:36 +0000
←[36m2014-05-28T04:22:36.393015+00:00 app[web.1]:←[0m   Rendered pins/_form.html
.erb (157.2ms)
←[36m2014-05-28T04:22:36.394461+00:00 app[web.1]:←[0m   Rendered layouts/_header
.html.erb (0.5ms)
←[33m2014-05-28T04:22:36.438942+00:00 heroku[router]:←[0m at=info method=GET pat
h=/pins/new host=arcane-shore-2097.herokuapp.com request_id=b4a031c5-97b2-4bf5-a
866-c755cdf22cdd fwd="190.114.248.109" dyno=web.1 connect=1ms service=256ms stat
us=304 bytes=887
←[36m2014-05-28T04:22:36.191863+00:00 app[web.1]:←[0m Processing by PinsControll
er#new as HTML
←[36m2014-05-28T04:22:36.393265+00:00 app[web.1]:←[0m   Rendered pins/new.html.e
rb within layouts/application (157.7ms)
←[36m2014-05-28T04:22:36.427215+00:00 app[web.1]:←[0m Completed 200 OK in 235ms
(Views: 159.8ms | ActiveRecord: 25.6ms)
←[33m2014-05-28T04:23:03.148051+00:00 heroku[router]:←[0m at=info method=GET pat
h=/pins/new host=arcane-shore-2097.herokuapp.com request_id=70c795ca-a65e-4cd9-b
8f0-8cac0f9e4e2f fwd="190.114.248.109" dyno=web.1 connect=4ms service=35ms statu
s=304 bytes=847
←[36m2014-05-28T04:23:03.113981+00:00 app[web.1]:←[0m Started GET "/pins/new" fo
r 190.114.248.109 at 2014-05-28 04:23:03 +0000
←[36m2014-05-28T04:23:03.128540+00:00 app[web.1]:←[0m   Rendered pins/_form.html
.erb (4.0ms)
←[36m2014-05-28T04:23:03.128672+00:00 app[web.1]:←[0m   Rendered pins/new.html.e
rb within layouts/application (4.6ms)
←[36m2014-05-28T04:23:03.130235+00:00 app[web.1]:←[0m   Rendered layouts/_header
.html.erb (0.7ms)
←[36m2014-05-28T04:23:03.130641+00:00 app[web.1]:←[0m Completed 200 OK in 13ms (
Views: 7.2ms | ActiveRecord: 1.4ms)
←[36m2014-05-28T04:23:03.116729+00:00 app[web.1]:←[0m Processing by PinsControll
er#new as HTML
←[36m2014-05-28T04:23:07.387929+00:00 app[web.1]:←[0m Started POST "/pins" for 1
90.114.248.109 at 2014-05-28 04:23:07 +0000
←[36m2014-05-28T04:23:07.621457+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f65eb72886e01c194ea9e49bb95cf1ed20140528-2-wglxgj.jpg[0]'
←[36m2014-05-28T04:23:07.394488+00:00 app[web.1]:←[0m   Parameters: {"utf8"=>"??
?", "authenticity_token"=>"3V8VcfPu/TLZRTNSpXAkpr/Ljz7TozETCrj++6fNmBg=", "pin"=
>{"image"=>#<ActionDispatch::Http::UploadedFile:0x007f0b9c28a6c8 @tempfile=#<Tem
pfile:/tmp/RackMultipart20140528-2-11b06h6>, @original_filename="4601_1346405869
_7587.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data
; name=\"pin[image]\"; filename=\"4601_1346405869_7587.jpg\"\r\nContent-Type: im
age/jpeg\r\n">, "description"=>""}, "commit"=>"Create Pin"}
←[36m2014-05-28T04:23:07.404862+00:00 app[web.1]:←[0m Command :: identify -forma
t '%wx%h,%[exif:orientation]' '/tmp/f65eb72886e01c194ea9e49bb95cf1ed20140528-2-w
glxgj.jpg[0]' 2>/dev/null
←[36m2014-05-28T04:23:07.394374+00:00 app[web.1]:←[0m Processing by PinsControll
er#create as HTML
←[36m2014-05-28T04:23:07.716143+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f65eb72886e01c194ea9e49bb95cf1ed20140528-2-wglxgj.jpg[0]'
←[36m2014-05-28T04:23:07.822689+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f65eb72886e01c194ea9e49bb95cf1ed20140528-2-wglxgj.jpg[0]'
←[36m2014-05-28T04:23:07.985010+00:00 app[web.1]:←[0m Command :: convert '/tmp/f
65eb72886e01c194ea9e49bb95cf1ed20140528-2-wglxgj.jpg[0]' -auto-orient -resize "3
00x300>" '/tmp/f65eb72886e01c194ea9e49bb95cf1ed20140528-2-wglxgj20140528-2-oovse
s'
←[36m2014-05-28T04:23:08.592273+00:00 app[web.1]:←[0m Command :: file -b --mime
'/tmp/f65eb72886e01c194ea9e49bb95cf1ed20140528-2-wglxgj20140528-2-oovses'
←[36m2014-05-28T04:23:08.781793+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f65eb72886e01c194ea9e49bb95cf1ed20140528-2-wglxgj.jpg[0]'
←[36m2014-05-28T04:23:08.662351+00:00 app[web.1]:←[0m Command :: identify -forma
t '%wx%h,%[exif:orientation]' '/tmp/f65eb72886e01c194ea9e49bb95cf1ed20140528-2-w
glxgj.jpg[0]' 2>/dev/null
←[36m2014-05-28T04:23:08.974084+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f65eb72886e01c194ea9e49bb95cf1ed20140528-2-wglxgj.jpg[0]'
←[36m2014-05-28T04:23:09.152338+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f65eb72886e01c194ea9e49bb95cf1ed20140528-2-wglxgj.jpg[0]'
←[36m2014-05-28T04:23:09.288490+00:00 app[web.1]:←[0m Command :: convert '/tmp/f
65eb72886e01c194ea9e49bb95cf1ed20140528-2-wglxgj.jpg[0]' -auto-orient -resize "1
00x100>" '/tmp/f65eb72886e01c194ea9e49bb95cf1ed20140528-2-wglxgj20140528-2-1tm6e
wc'
←[36m2014-05-28T04:23:10.087103+00:00 app[web.1]:←[0m Command :: file -b --mime
'/tmp/f65eb72886e01c194ea9e49bb95cf1ed20140528-2-wglxgj20140528-2-1tm6ewc'
←[33m2014-05-28T04:23:10.501345+00:00 heroku[router]:←[0m at=info method=POST pa
th=/pins host=arcane-shore-2097.herokuapp.com request_id=add40038-e52b-412b-bed9
-f171b8137c14 fwd="190.114.248.109" dyno=web.1 connect=1ms service=4095ms status
=500 bytes=1754
←[36m2014-05-28T04:23:10.468569+00:00 app[web.1]:←[0m [AWS S3 403 0.161086 0 ret
ries] put_object(:acl=>:public_read,:bucket_name=>"pinteresting_frankz",:content
_length=>94339,:content_type=>"image/jpeg",:data=>Paperclip::UploadedFileAdapter
: 4601_1346405869_7587.jpg,:key=>"pins/images/000/000/015/original/4601_13464058
69_7587.jpg") AWS::S3::Errors::SignatureDoesNotMatch The request signature we ca
lculated does not match the signature you provided. Check your key and signing m
ethod.
←[36m2014-05-28T04:23:10.468587+00:00 app[web.1]:←[0m
←[36m2014-05-28T04:23:10.294838+00:00 app[web.1]:←[0m [paperclip] saving /pins/i
mages/000/000/015/original/4601_1346405869_7587.jpg
←[36m2014-05-28T04:23:10.476544+00:00 app[web.1]:←[0m Completed 500 Internal Ser
ver Error in 3082ms
←[36m2014-05-28T04:23:10.481128+00:00 app[web.1]:←[0m
←[36m2014-05-28T04:23:10.481134+00:00 app[web.1]:←[0m AWS::S3::Errors::Signature
DoesNotMatch (The request signature we calculated does not match the signature y
ou provided. Check your key and signing method.):
←[36m2014-05-28T04:23:10.481136+00:00 app[web.1]:←[0m   app/controllers/pins_con
troller.rb:22:in `create'
←[36m2014-05-28T04:23:10.481137+00:00 app[web.1]:←[0m
←[36m2014-05-28T04:23:10.481139+00:00 app[web.1]:←[0m   

Thanks for the help

Here's the error:

AWS::S3::Errors::Signature DoesNotMatch (The request signature we calculated does not match the signature you provided. Check your key and signing method.):

Looks like an error with your AWS access key. This answer recommends you may have leading or trailing slashes in your key definitions

您的访问密钥格式无效,亚马逊无法正确读取。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM