Reputation: 566
I am doing the One Month Rails course and i get stucked in one point.
I have my app in Heroku: http://arcane-shelf-3404.herokuapp.com/
But when i upload an image, it give me an error.
Help me to find the error. Thanks!
Here is my log:
←[36m2014-06-02T06:19:47.681565+00:00 app[web.1]:←[0m Command :: convert '/tmp/f
85a2368337734c012dda7e3c61bfb8920140602-2-1s8hujo.png[0]' -auto-orient -resize "
100x100>" '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-1s8hujo20140602-2-1rj
ixun'
←[36m2014-06-02T06:19:47.955359+00:00 app[web.1]:←[0m Command :: file -b --mime
'/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-1s8hujo20140602-2-1rjixun'
←[36m2014-06-02T06:19:48.191298+00:00 app[web.1]:←[0m Completed 500 Internal Ser
ver Error in 2818ms
←[33m2014-06-02T06:19:48.276690+00:00 heroku[router]:←[0m at=info method=POST pa
th=/pins host=arcane-shelf-3404.herokuapp.com request_id=aa625159-c846-4e33-b931
-be0ed643437a fwd="190.114.248.109" dyno=web.1 connect=1ms service=3937ms status
=500 bytes=1754
←[36m2014-06-02T06:19:48.211023+00:00 app[web.1]:←[0m
←[36m2014-06-02T06:19:48.176176+00:00 app[web.1]:←[0m [paperclip] saving /pins/i
mages/000/000/003/original/GDT05_camera_lens3.png
←[36m2014-06-02T06:19:48.211031+00:00 app[web.1]:←[0m app/controllers/pins_con
troller.rb:22:in `create'
←[36m2014-06-02T06:19:48.211028+00:00 app[web.1]:←[0m ArgumentError (missing req
uired :bucket option):
←[36m2014-06-02T06:19:48.211032+00:00 app[web.1]:←[0m
←[36m2014-06-02T06:19:48.211033+00:00 app[web.1]:←[0m
←[36m2014-06-02T06:21:06.259776+00:00 heroku[web.1]:←[0m State changed from up t
o starting
←[36m2014-06-02T06:21:10.133404+00:00 app[web.1]:←[0m [2014-06-02 06:21:10] FATA
L SignalException: SIGTERM
←[36m2014-06-02T06:21:10.133409+00:00 app[web.1]:←[0m /app/vendor/ruby-2.0.0/l
ib/ruby/2.0.0/webrick/server.rb:170:in `select'
←[36m2014-06-02T06:21:10.133414+00:00 app[web.1]:←[0m /app/vendor/ruby-2.0.0/l
ib/ruby/2.0.0/webrick/server.rb:160:in `start'
←[36m2014-06-02T06:21:10.133433+00:00 app[web.1]:←[0m /app/vendor/bundle/ruby/
2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:14:in `run'
←[36m2014-06-02T06:21:10.133411+00:00 app[web.1]:←[0m /app/vendor/ruby-2.0.0/l
ib/ruby/2.0.0/webrick/server.rb:170:in `block in start'
←[36m2014-06-02T06:21:10.133435+00:00 app[web.1]:←[0m /app/vendor/bundle/ruby/
2.0.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
←[36m2014-06-02T06:21:10.133436+00:00 app[web.1]:←[0m /app/vendor/bundle/ruby/
2.0.0/gems/railties-4.1.1/lib/rails/commands/server.rb:69:in `start'
←[36m2014-06-02T06:21:10.133444+00:00 app[web.1]:←[0m /app/vendor/bundle/ruby/
2.0.0/gems/railties-4.1.1/lib/rails/commands.rb:17:in `<top (required)>'
←[36m2014-06-02T06:21:10.133446+00:00 app[web.1]:←[0m bin/rails:4:in `require'
←[36m2014-06-02T06:21:10.133412+00:00 app[web.1]:←[0m /app/vendor/ruby-2.0.0/l
ib/ruby/2.0.0/webrick/server.rb:32:in `start'
←[36m2014-06-02T06:21:10.133448+00:00 app[web.1]:←[0m bin/rails:4:in `<main>'
←[36m2014-06-02T06:21:10.133493+00:00 app[web.1]:←[0m [2014-06-02 06:21:10] INFO
going to shutdown ...
←[36m2014-06-02T06:21:10.133442+00:00 app[web.1]:←[0m /app/vendor/bundle/ruby/
2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:76:in `server'
←[36m2014-06-02T06:21:10.133655+00:00 app[web.1]:←[0m [2014-06-02 06:21:10] INFO
WEBrick::HTTPServer#start done.
←[36m2014-06-02T06:21:10.133706+00:00 app[web.1]:←[0m Exiting
←[36m2014-06-02T06:21:10.133443+00:00 app[web.1]:←[0m /app/vendor/bundle/ruby/
2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:40:in `run_comman
d!'
←[36m2014-06-02T06:21:10.133440+00:00 app[web.1]:←[0m /app/vendor/bundle/ruby/
2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:76:in `tap'
←[36m2014-06-02T06:21:10.133438+00:00 app[web.1]:←[0m /app/vendor/bundle/ruby/
2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:81:in `block in s
erver'
←[36m2014-06-02T06:21:10.346377+00:00 heroku[web.1]:←[0m Starting process with c
ommand `bin/rails server -p 50269 -e production`
←[36m2014-06-02T06:21:09.495879+00:00 heroku[web.1]:←[0m Stopping all processes
with SIGTERM
←[36m2014-06-02T06:21:11.476607+00:00 heroku[web.1]:←[0m Process exited with sta
tus 143
←[36m2014-06-02T06:21:17.901730+00:00 heroku[web.1]:←[0m State changed from star
ting to up
←[36m2014-06-02T06:21:17.802200+00:00 app[web.1]:←[0m [2014-06-02 06:21:17] INFO
WEBrick 1.3.1
←[36m2014-06-02T06:21:17.802319+00:00 app[web.1]:←[0m [2014-06-02 06:21:17] INFO
ruby 2.0.0 (2014-05-08) [x86_64-linux]
←[36m2014-06-02T06:21:17.802903+00:00 app[web.1]:←[0m [2014-06-02 06:21:17] INFO
WEBrick::HTTPServer#start: pid=2 port=50269
←[36m2014-06-02T06:21:19.273758+00:00 app[web.1]:←[0m => Rails 4.1.1 application
starting in production on http://0.0.0.0:50269
←[36m2014-06-02T06:21:19.273760+00:00 app[web.1]:←[0m => Run `rails server -h` f
or more startup options
←[36m2014-06-02T06:21:19.273751+00:00 app[web.1]:←[0m => Booting WEBrick
←[36m2014-06-02T06:21:19.273762+00:00 app[web.1]:←[0m => Notice: server is liste
ning on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
←[36m2014-06-02T06:21:19.273763+00:00 app[web.1]:←[0m => Ctrl-C to shutdown serv
er
←[36m2014-06-02T06:21:19.273765+00:00 app[web.1]:←[0m Started POST "/pins" for 1
90.114.248.109 at 2014-06-02 06:21:19 +0000
←[36m2014-06-02T06:21:19.379258+00:00 app[web.1]:←[0m Processing by PinsControll
er#create as HTML
←[36m2014-06-02T06:21:19.379355+00:00 app[web.1]:←[0m Parameters: {"utf8"=>"??
?", "authenticity_token"=>"EMnpdVv9KK1Sz/kCL9X21W+6mfepM8/D+QFelQvmXXM=", "pin"=
>{"image"=>#<ActionDispatch::Http::UploadedFile:0x007fbb4ee7c4d8 @tempfile=#<Tem
pfile:/tmp/RackMultipart20140602-2-1hvrs94>, @original_filename="GDT05_camera le
ns3.png", @content_type="image/png", @headers="Content-Disposition: form-data; n
ame=\"pin[image]\"; filename=\"GDT05_camera lens3.png\"\r\nContent-Type: image/p
ng\r\n">, "description"=>"asdadad"}, "commit"=>"Create Pin"}
←[36m2014-06-02T06:21:19.466196+00:00 app[web.1]:←[0m Command :: identify -forma
t '%wx%h,%[exif:orientation]' '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-1
lj566b.png[0]' 2>/dev/null
←[36m2014-06-02T06:21:19.707875+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-1lj566b.png[0]'
←[36m2014-06-02T06:21:19.525316+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-1lj566b.png[0]'
←[36m2014-06-02T06:21:19.593996+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-1lj566b.png[0]'
←[36m2014-06-02T06:21:19.831975+00:00 app[web.1]:←[0m Command :: convert '/tmp/f
85a2368337734c012dda7e3c61bfb8920140602-2-1lj566b.png[0]' -auto-orient -resize "
300x300>" '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-1lj566b20140602-2-qn5
wzi'
←[36m2014-06-02T06:21:20.409313+00:00 app[web.1]:←[0m Command :: file -b --mime
'/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-1lj566b20140602-2-qn5wzi'
←[36m2014-06-02T06:21:20.654060+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-1lj566b.png[0]'
←[36m2014-06-02T06:21:20.542819+00:00 app[web.1]:←[0m Command :: identify -forma
t '%wx%h,%[exif:orientation]' '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-1
lj566b.png[0]' 2>/dev/null
←[36m2014-06-02T06:21:20.767431+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-1lj566b.png[0]'
←[36m2014-06-02T06:21:20.842459+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-1lj566b.png[0]'
←[36m2014-06-02T06:21:20.913966+00:00 app[web.1]:←[0m Command :: convert '/tmp/f
85a2368337734c012dda7e3c61bfb8920140602-2-1lj566b.png[0]' -auto-orient -resize "
100x100>" '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-1lj566b20140602-2-kzm
tux'
←[36m2014-06-02T06:21:21.199779+00:00 app[web.1]:←[0m Command :: file -b --mime
'/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-1lj566b20140602-2-kzmtux'
←[36m2014-06-02T06:21:21.366506+00:00 app[web.1]:←[0m [paperclip] saving /pins/i
mages/000/000/004/original/GDT05_camera_lens3.png
←[33m2014-06-02T06:21:23.087200+00:00 heroku[router]:←[0m at=info method=POST pa
th=/pins host=arcane-shelf-3404.herokuapp.com request_id=4161c089-c9d8-4111-90bf
-4f4d43c3ec06 fwd="190.114.248.109" dyno=web.1 connect=5ms service=4078ms status
=500 bytes=1754
←[36m2014-06-02T06:21:22.992585+00:00 app[web.1]:←[0m Completed 500 Internal Ser
ver Error in 3583ms
←[36m2014-06-02T06:21:22.994508+00:00 app[web.1]:←[0m
←[36m2014-06-02T06:21:22.994513+00:00 app[web.1]:←[0m app/controllers/pins_con
troller.rb:22:in `create'
←[36m2014-06-02T06:21:22.994517+00:00 app[web.1]:←[0m
←[36m2014-06-02T06:21:22.994511+00:00 app[web.1]:←[0m ArgumentError (missing req
uired :bucket option):
←[36m2014-06-02T06:21:22.994515+00:00 app[web.1]:←[0m
←[33m2014-06-02T06:21:23.557093+00:00 heroku[router]:←[0m at=info method=GET pat
h=/favicon.ico host=arcane-shelf-3404.herokuapp.com request_id=7362fd76-f3a3-43c
c-9e15-9dc5b67c7646 fwd="190.114.248.109" dyno=web.1 connect=1ms service=12ms st
atus=304 bytes=133
←[33m2014-06-02T06:21:27.043612+00:00 heroku[router]:←[0m at=info method=GET pat
h=/ host=arcane-shelf-3404.herokuapp.com request_id=fa665a0f-e648-46c7-91e1-90dc
b9f707c9 fwd="190.114.248.109" dyno=web.1 connect=1ms service=91ms status=200 by
tes=2820
←[36m2014-06-02T06:21:26.958962+00:00 app[web.1]:←[0m Started GET "/" for 190.11
4.248.109 at 2014-06-02 06:21:26 +0000
←[36m2014-06-02T06:21:27.011097+00:00 app[web.1]:←[0m Rendered pins/index.html
.erb within layouts/application (20.0ms)
←[36m2014-06-02T06:21:27.031399+00:00 app[web.1]:←[0m Completed 200 OK in 58ms (
Views: 45.2ms | ActiveRecord: 6.9ms)
←[36m2014-06-02T06:21:26.973229+00:00 app[web.1]:←[0m Processing by PinsControll
er#index as HTML
←[36m2014-06-02T06:21:27.028535+00:00 app[web.1]:←[0m Rendered layouts/_header
.html.erb (9.7ms)
←[33m2014-06-02T06:21:28.866584+00:00 heroku[router]:←[0m at=info method=GET pat
h=/pins/new host=arcane-shelf-3404.herokuapp.com request_id=0a7fdeb0-f980-4238-a
0d2-ea2144baccea fwd="190.114.248.109" dyno=web.1 connect=1ms service=134ms stat
us=304 bytes=887
←[36m2014-06-02T06:21:28.743259+00:00 app[web.1]:←[0m Started GET "/pins/new" fo
r 190.114.248.109 at 2014-06-02 06:21:28 +0000
←[36m2014-06-02T06:21:28.835827+00:00 app[web.1]:←[0m Rendered pins/_form.html
.erb (34.4ms)
←[36m2014-06-02T06:21:28.857782+00:00 app[web.1]:←[0m Rendered layouts/_header
.html.erb (16.6ms)
←[36m2014-06-02T06:21:28.749705+00:00 app[web.1]:←[0m Processing by PinsControll
er#new as HTML
←[36m2014-06-02T06:21:28.839410+00:00 app[web.1]:←[0m Rendered pins/new.html.e
rb within layouts/application (43.5ms)
←[36m2014-06-02T06:21:28.858300+00:00 app[web.1]:←[0m Completed 200 OK in 109ms
(Views: 68.2ms | ActiveRecord: 1.5ms)
←[36m2014-06-02T06:21:33.993156+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-zzqfd6.png[0]'
←[36m2014-06-02T06:21:33.822304+00:00 app[web.1]:←[0m Started POST "/pins" for 1
90.114.248.109 at 2014-06-02 06:21:33 +0000
←[36m2014-06-02T06:21:33.826962+00:00 app[web.1]:←[0m Processing by PinsControll
er#create as HTML
←[36m2014-06-02T06:21:33.827030+00:00 app[web.1]:←[0m Parameters: {"utf8"=>"??
?", "authenticity_token"=>"EMnpdVv9KK1Sz/kCL9X21W+6mfepM8/D+QFelQvmXXM=", "pin"=
>{"image"=>#<ActionDispatch::Http::UploadedFile:0x007fbb4badc498 @tempfile=#<Tem
pfile:/tmp/RackMultipart20140602-2-3jyqo2>, @original_filename="GDT05_camera len
s3.png", @content_type="image/png", @headers="Content-Disposition: form-data; na
me=\"pin[image]\"; filename=\"GDT05_camera lens3.png\"\r\nContent-Type: image/pn
g\r\n">, "description"=>"asdadasdasda"}, "commit"=>"Create Pin"}
←[36m2014-06-02T06:21:33.869769+00:00 app[web.1]:←[0m Command :: identify -forma
t '%wx%h,%[exif:orientation]' '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-z
zqfd6.png[0]' 2>/dev/null
←[36m2014-06-02T06:21:34.091066+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-zzqfd6.png[0]'
←[36m2014-06-02T06:21:34.194753+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-zzqfd6.png[0]'
←[36m2014-06-02T06:21:34.387242+00:00 app[web.1]:←[0m Command :: convert '/tmp/f
85a2368337734c012dda7e3c61bfb8920140602-2-zzqfd6.png[0]' -auto-orient -resize "3
00x300>" '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-zzqfd620140602-2-w9apg
o'
←[36m2014-06-02T06:21:34.936114+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-zzqfd6.png[0]'
←[36m2014-06-02T06:21:34.714299+00:00 app[web.1]:←[0m Command :: file -b --mime
'/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-zzqfd620140602-2-w9apgo'
←[36m2014-06-02T06:21:34.798542+00:00 app[web.1]:←[0m Command :: identify -forma
t '%wx%h,%[exif:orientation]' '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-z
zqfd6.png[0]' 2>/dev/null
←[36m2014-06-02T06:21:35.007664+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-zzqfd6.png[0]'
←[36m2014-06-02T06:21:35.083964+00:00 app[web.1]:←[0m Command :: identify -forma
t %m '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-zzqfd6.png[0]'
←[36m2014-06-02T06:21:35.155921+00:00 app[web.1]:←[0m Command :: convert '/tmp/f
85a2368337734c012dda7e3c61bfb8920140602-2-zzqfd6.png[0]' -auto-orient -resize "1
00x100>" '/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-zzqfd620140602-2-tcs6x
q'
←[36m2014-06-02T06:21:35.336235+00:00 app[web.1]:←[0m Command :: file -b --mime
'/tmp/f85a2368337734c012dda7e3c61bfb8920140602-2-zzqfd620140602-2-tcs6xq'
←[36m2014-06-02T06:21:35.400880+00:00 app[web.1]:←[0m Completed 500 Internal Ser
ver Error in 1574ms
←[33m2014-06-02T06:21:35.408004+00:00 heroku[router]:←[0m at=info method=POST pa
th=/pins host=arcane-shelf-3404.herokuapp.com request_id=806524e8-55f9-4415-b36c
-ff49090c6bda fwd="190.114.248.109" dyno=web.1 connect=1ms service=1986ms status
=500 bytes=1754
←[36m2014-06-02T06:21:35.406124+00:00 app[web.1]:←[0m ArgumentError (missing req
uired :bucket option):
←[36m2014-06-02T06:21:35.406127+00:00 app[web.1]:←[0m
←[36m2014-06-02T06:21:35.406118+00:00 app[web.1]:←[0m
←[36m2014-06-02T06:21:35.397496+00:00 app[web.1]:←[0m [paperclip] saving /pins/i
mages/000/000/005/original/GDT05_camera_lens3.png
←[36m2014-06-02T06:21:35.406126+00:00 app[web.1]:←[0m app/controllers/pins_con
troller.rb:22:in `create'
←[36m2014-06-02T06:21:35.406128+00:00 app[web.1]:←[0m
Upvotes: 2
Views: 598
Reputation: 566
I solved it!
Write this in your production.rb
config.paperclip_defaults = {
:storage => :s3,
:s3_credentials => {
:bucket => ENV['AWS_BUCKET'],
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
}
Upvotes: 1
Reputation: 76784
ArgumentError (missing required :bucket option):
That's your error, and it's defined as a Paperclip
problem.
The issue will be that you're trying to use the s3
connectivity in Paperclip, but have not defined the bucket
option (which is required)
There are two ways to fix this problem:
1) Model
As defined in the Paperclip docs, you can set the bucket
option in your model:
#app/models/your_model.rb
has_attached_file :image,
:styles => { :medium => "x300", :thumb => "x100" },
:storage => :s3,
:bucket => '******',
:s3_credentials => S3_CREDENTIALS
2) Config
A far more robust way is to use the config
files of your system to fix it. The way to do this is to use the production.rb
file to define the bucket once:
#config/environments/production.rb
....
Paperclip::Attachment.default_options.merge!({
storage: :s3,
s3_credentials: {
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
},
bucket: ENV['S3_BUCKET_NAME']
})
As you may be able to tell; both of these are from our current codebase, so should work. The only issue you may have is the config
script might need tweaking. If you comment, I'll help
Upvotes: 2