Ruby on rails AWS::S3::错误::拒绝访问。无法使用Ruby on Rails保存到S3

Ruby on rails AWS::S3::错误::拒绝访问。无法使用Ruby on Rails保存到S3,ruby-on-rails,amazon-web-services,heroku,amazon-s3,paperclip,Ruby On Rails,Amazon Web Services,Heroku,Amazon S3,Paperclip,我正在尝试将AmazonS3连接到我的站点,以便存储用户头像。我希望用户能够将化身添加到他们的个人资料中,但我似乎被拒绝访问。我已经研究并尝试了几种解决方案,但都没有成功: 错误消息: 2016-02-03T23:30:12.826846+00:00 app[web.1]: Rendered pages/home.html.erb within layouts/application (1.3ms) 2016-02-03T23:30:12.830420+00:00 app[web.1]

我正在尝试将AmazonS3连接到我的站点,以便存储用户头像。我希望用户能够将化身添加到他们的个人资料中,但我似乎被拒绝访问。我已经研究并尝试了几种解决方案,但都没有成功:

错误消息:

2016-02-03T23:30:12.826846+00:00 app[web.1]:   Rendered pages/home.html.erb within layouts/application (1.3ms)
2016-02-03T23:30:12.830420+00:00 app[web.1]: Completed 200 OK in 9ms (Views: 6.1ms | ActiveRecord: 1.2ms)
2016-02-03T23:30:12.821127+00:00 app[web.1]: Processing by PagesController#home as HTML
2016-02-03T23:30:12.830151+00:00 app[web.1]:   Rendered layouts/_header.html.erb (0.9ms)
2016-02-03T23:30:12.824076+00:00 app[web.1]:   Plan Load (0.5ms)  SELECT  "plans".* FROM "plans"  WHERE "plans"."name" = 'mentee' LIMIT 1
2016-02-03T23:31:23.614411+00:00 app[web.1]: Processing by ProfilesController#create as HTML
2016-02-03T23:31:23.618346+00:00 app[web.1]:   User Load (1.3ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = 32  ORDER BY "users"."id" ASC LIMIT 1
2016-02-03T23:31:23.621171+00:00 app[web.1]:   CACHE (0.0ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = $1 LIMIT 1  [["id", "32"]]
2016-02-03T23:31:23.642828+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex6.jpg[0]' 2>/dev/null
2016-02-03T23:31:23.731583+00:00 app[web.1]: Command :: convert '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex6.jpg[0]' -auto-orient -resize "300x300>" '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex620160203-3-zkzzqj'
2016-02-03T23:31:23.610892+00:00 app[web.1]: Started POST "/users/32/profile" for 108.80.140.163 at 2016-02-03 23:31:23 +0000
2016-02-03T23:31:23.615000+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"ArxGVYON7jf+nRR9HfMcpHWxSgk4uHIw7ELCnDaJhvc=", "profile"=>{"not_available"=>"0", "first_name"=>"Kim", "last_name"=>"Crayton", "avatar"=>#<ActionDispatch::Http::UploadedFile:0x007fe496024c48 @tempfile=#<Tempfile:/tmp/RackMultipart20160203-3-1nmybbz>, @original_filename="Kim Crayton.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"profile[avatar]\"; filename=\"Kim Crayton.jpg\"\r\nContent-Type: image/jpeg\r\n">, "contact_email"=>"kimmcrayton@gmail.com", "city"=>"Atlanta", "state"=>"GA", "country"=>"USA", "coding_languages"=>"HTML, CSS, JavaScript, Python", "bio"=>"I was an educator, writer, and researcher in another life who decided to dive into the coding end of the pool. I've learned the basics on my own and like most who want to swim in the Olympics, I need a good coach to get me to the next level.", "mentoring_needs"=>"To be able to level up my skill set to become employed as a Jr. Developer"}, "commit"=>"Update Profile", "user_id"=>"32"}
2016-02-03T23:31:23.620344+00:00 app[web.1]:   User Load (0.8ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = $1 LIMIT 1  [["id", 32]]
2016-02-03T23:31:23.629345+00:00 app[web.1]: Command :: file -b --mime '/tmp/7ad9d08462a928e43510aef94b436bb820160203-3-1p8wtua.jpg'
2016-02-03T23:31:23.717450+00:00 app[web.1]: Command :: identify -format %m '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex6.jpg[0]'
2016-02-03T23:31:24.346558+00:00 app[web.1]: Command :: file -b --mime '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex620160203-3-zkzzqj'
2016-02-03T23:31:24.468671+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex6.jpg[0]' 2>/dev/null
2016-02-03T23:31:25.276211+00:00 app[web.1]: Command :: identify -format %m '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex6.jpg[0]'
2016-02-03T23:31:25.356070+00:00 app[web.1]: Command :: convert '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex6.jpg[0]' -auto-orient -resize "100x100>" '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex620160203-3-6j3feu'
2016-02-03T23:31:25.933442+00:00 app[web.1]: Command :: file -b --mime '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex620160203-3-6j3feu'
2016-02-03T23:31:25.968535+00:00 app[web.1]:    (1.8ms)  BEGIN
2016-02-03T23:31:26.011723+00:00 app[web.1]:   SQL (1.9ms)  INSERT INTO "profiles" ("avatar_content_type", "avatar_file_name", "avatar_file_size", "avatar_updated_at", "bio", "city", "coding_languages", "contact_email", "country", "created_at", "first_name", "last_name", "mentoring_needs", "state", "updated_at", "user_id") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16) RETURNING "id"  [["avatar_content_type", "image/jpeg"], ["avatar_file_name", "Kim_Crayton.jpg"], ["avatar_file_size", 588778], ["avatar_updated_at", "2016-02-03 23:31:23.627122"], ["bio", "I was an educator, writer, and researcher in another life who decided to dive into the coding end of the pool. I've learned the basics on my own and like most who want to swim in the Olympics, I need a good coach to get me to the next level."], ["city", "Atlanta"], ["coding_languages", "HTML, CSS, JavaScript, Python"], ["contact_email", "kimmcrayton@gmail.com"], ["country", "USA"], ["created_at", "2016-02-03 23:31:26.002769"], ["first_name", "Kim"], ["last_name", "Crayton"], ["mentoring_needs", "To be able to level up my skill set to become employed as a Jr. Developer"], ["state", "GA"], ["updated_at", "2016-02-03 23:31:26.002769"], ["user_id", 32]]
2016-02-03T23:31:25.965320+00:00 app[web.1]:   Profile Load (8.5ms)  SELECT  "profiles".* FROM "profiles"  WHERE "profiles"."user_id" = $1 LIMIT 1  [["user_id", 32]]
2016-02-03T23:31:26.012791+00:00 app[web.1]: [paperclip] saving /profiles/avatars/000/000/024/original/Kim_Crayton.jpg
2016-02-03T23:31:25.972587+00:00 app[web.1]: Command :: file -b --mime '/tmp/7ad9d08462a928e43510aef94b436bb820160203-3-1fkobfh.jpg'
2016-02-03T23:31:26.192049+00:00 app[web.1]: [AWS S3 403 0.176059 0 retries] put_object(:acl=>:public_read,:bucket_name=>"BUCKET_NAME_VALUE",:content_length=>588778,:content_type=>"image/jpeg",:data=>Paperclip::UploadedFileAdapter: Kim Crayton.jpg,:key=>"profiles/avatars/000/000/024/original/Kim_Crayton.jpg") AWS::S3::Errors::AccessDenied Access Denied
2016-02-03T23:31:26.192052+00:00 app[web.1]:
2016-02-03T23:31:26.199059+00:00 app[web.1]:    (5.4ms)  ROLLBACK
2016-02-03T23:31:26.239693+00:00 app[web.1]: Completed 500 Internal Server Error in 2625ms
2016-02-03T23:31:26.278651+00:00 app[web.1]: [Rollbar] Scheduling payload
2016-02-03T23:31:26.278749+00:00 app[web.1]: [Rollbar] Sending payload
2016-02-03T23:31:26.255527+00:00 app[web.1]: [Rollbar] Reporting exception: Access Denied
2016-02-03T23:31:26.565131+00:00 heroku[router]: at=info method=POST path="/users/32/profile" host=www.jrdevmentoring.com request_id=39b4d6a4-de82-4746-bba2-15326511c36c fwd="108.80.140.163" dyno=web.1 connect=0ms service=5691ms status=500 bytes=1754
2016-02-03T23:31:26.556786+00:00 app[web.1]: [Rollbar] Success
2016-02-03T23:31:26.556867+00:00 app[web.1]: [Rollbar] Details: https://rollbar.com/instance/uuid?uuid=e2c97cca-326f-4501-a1ac-dabcedc8d047 (only available if report was successful)
2016-02-03T23:31:26.556955+00:00 app[web.1]: [Rollbar] Exception uuid saved in env: e2c97cca-326f-4501-a1ac-dabcedc8d047
2016-02-03T23:31:26.562072+00:00 app[web.1]:
2016-02-03T23:31:26.562074+00:00 app[web.1]:   app/controllers/profiles_controller.rb:13:in `create'
2016-02-03T23:31:26.562075+00:00 app[web.1]:
2016-02-03T23:31:26.562074+00:00 app[web.1]: AWS::S3::Errors::AccessDenied (Access Denied):
2016-02-03T23:31:26.562075+00:00 app[web.1]:
2016-02-03T23:32:23.939135+00:00 heroku[router]: at=info method=GET path="/users/32/profile/new" host=www.jrdevmentoring.com request_id=a926abfc-e512-42cc-bcf0-b49f0e660051 fwd="108.80.140.163" dyno=web.1 connect=0ms service=22ms status=304 bytes=844
2016-02-03T23:32:23.921568+00:00 app[web.1]:   Parameters: {"user_id"=>"32"}
2016-02-03T23:32:23.921563+00:00 app[web.1]: Processing by ProfilesController#new as HTML
2016-02-03T23:32:23.924214+00:00 app[web.1]:   User Load (0.8ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = 32  ORDER BY "users"."id" ASC LIMIT 1
2016-02-03T23:32:23.926869+00:00 app[web.1]:   CACHE (0.0ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = $1 LIMIT 1  [["id", "32"]]
2016-02-03T23:32:23.934672+00:00 app[web.1]:   Rendered profiles/_form.html.erb (5.2ms)
2016-02-03T23:32:23.934795+00:00 app[web.1]:   Rendered profiles/new.html.erb within layouts/mentee_layout (5.5ms)
2016-02-03T23:32:23.935958+00:00 app[web.1]:   Rendered layouts/_header.html.erb (0.4ms)
2016-02-03T23:32:23.919293+00:00 app[web.1]: Started GET "/users/32/profile/new" for 108.80.140.163 at 2016-02-03 23:32:23 +0000
2016-02-03T23:32:23.926294+00:00 app[web.1]:   User Load (1.0ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = $1 LIMIT 1  [["id", 32]]
2016-02-03T23:32:23.936324+00:00 app[web.1]: Completed 200 OK in 15ms (Views: 8.2ms | ActiveRecord: 2.5ms)
2016-02-03T23:32:23.928924+00:00 app[web.1]:   Plan Load (0.7ms)  SELECT  "plans".* FROM "plans"  WHERE "plans"."id" = $1 LIMIT 1  [["id", 30]]
2016-02-03T23:32:24.067025+00:00 heroku[router]: at=info method=GET path="/assets/application-ccf1b63ef283bc859fc20d775228d578.js" host=www.jrdevmentoring.com request_id=fd39d73a-d506-4b69-ac11-042db1ca8cee fwd="108.80.140.163" dyno=web.1 connect=0ms service=16ms status=304 bytes=133
2016-02-03T23:32:24.051947+00:00 heroku[router]: at=info method=GET path="/assets/application-9750215382cdb39b0d4756e6b205dd25.css" host=www.jrdevmentoring.com request_id=7f1972d5-75f3-469c-9672-2d149981a9b9 fwd="108.80.140.163" dyno=web.1 connect=0ms service=8ms status=304 bytes=133
2016-02-03T23:32:28.231345+00:00 app[web.1]:   User Load (0.6ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = $1 LIMIT 1  [["id", 32]]
2016-02-03T23:32:28.222520+00:00 app[web.1]: Started POST "/users/32/profile" for 108.80.140.163 at 2016-02-03 23:32:28 +0000
2016-02-03T23:32:28.367338+00:00 app[web.1]: Command :: identify -format %m '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf.jpg[0]'
2016-02-03T23:32:28.240793+00:00 app[web.1]: Command :: file -b --mime '/tmp/7ad9d08462a928e43510aef94b436bb820160203-3-133toy1.jpg'
2016-02-03T23:32:28.225432+00:00 app[web.1]: Processing by ProfilesController#create as HTML
2016-02-03T23:32:28.225555+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"ArxGVYON7jf+nRR9HfMcpHWxSgk4uHIw7ELCnDaJhvc=", "profile"=>{"not_available"=>"0", "first_name"=>"Kim", "last_name"=>"Crayton", "avatar"=>#<ActionDispatch::Http::UploadedFile:0x007fe496024c48 @tempfile=#<Tempfile:/tmp/RackMultipart20160203-3-spce1k>, @original_filename="Kim Crayton.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"profile[avatar]\"; filename=\"Kim Crayton.jpg\"\r\nContent-Type: image/jpeg\r\n">, "contact_email"=>"kimmcrayton@gmail.com", "city"=>"Atlanta", "state"=>"GA", "country"=>"USA", "coding_languages"=>"HTML, CSS, JavaScript, Python", "bio"=>"I was an educator, writer, and researcher in another life who decided to dive into the coding end of the pool. I've learned the basics on my own and like most who want to swim in the Olympics, I need a good coach to get me to the next level.", "mentoring_needs"=>"To be able to level up my skill set to become employed as a Jr. Developer"}, "commit"=>"Update Profile", "user_id"=>"32"}
2016-02-03T23:32:28.229747+00:00 app[web.1]:   User Load (1.7ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = 32  ORDER BY "users"."id" ASC LIMIT 1
2016-02-03T23:32:28.232006+00:00 app[web.1]:   CACHE (0.0ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = $1 LIMIT 1  [["id", "32"]]
2016-02-03T23:32:28.411553+00:00 app[web.1]: Command :: convert '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf.jpg[0]' -auto-orient -resize "300x300>" '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf20160203-3-bep14i'
2016-02-03T23:32:28.254571+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf.jpg[0]' 2>/dev/null
2016-02-03T23:32:29.005396+00:00 app[web.1]: Command :: file -b --mime '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf20160203-3-bep14i'
2016-02-03T23:32:29.215235+00:00 app[web.1]: Command :: identify -format %m '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf.jpg[0]'
2016-02-03T23:32:29.042851+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf.jpg[0]' 2>/dev/null
2016-02-03T23:32:29.254140+00:00 app[web.1]: Command :: convert '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf.jpg[0]' -auto-orient -resize "100x100>" '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf20160203-3-18abmic'
2016-02-03T23:32:29.899670+00:00 app[web.1]: Command :: file -b --mime '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf20160203-3-18abmic'
2016-02-03T23:32:29.934163+00:00 app[web.1]:   SQL (1.0ms)  INSERT INTO "profiles" ("avatar_content_type", "avatar_file_name", "avatar_file_size", "avatar_updated_at", "bio", "city", "coding_languages", "contact_email", "country", "created_at", "first_name", "last_name", "mentoring_needs", "state", "updated_at", "user_id") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16) RETURNING "id"  [["avatar_content_type", "image/jpeg"], ["avatar_file_name", "Kim_Crayton.jpg"], ["avatar_file_size", 588778], ["avatar_updated_at", "2016-02-03 23:32:28.238610"], ["bio", "I was an educator, writer, and researcher in another life who decided to dive into the coding end of the pool. I've learned the basics on my own and like most who want to swim in the Olympics, I need a good coach to get me to the next level."], ["city", "Atlanta"], ["coding_languages", "HTML, CSS, JavaScript, Python"], ["contact_email", "kimmcrayton@gmail.com"], ["country", "USA"], ["created_at", "2016-02-03 23:32:29.931498"], ["first_name", "Kim"], ["last_name", "Crayton"], ["mentoring_needs", "To be able to level up my skill set to become employed as a Jr. Developer"], ["state", "GA"], ["updated_at", "2016-02-03 23:32:29.931498"], ["user_id", 32]]
2016-02-03T23:32:29.983370+00:00 app[web.1]: [AWS S3 403 0.044695 0 retries] put_object(:acl=>:public_read,:bucket_name=>"BUCKET_NAME_VALUE",:content_length=>588778,:content_type=>"image/jpeg",:data=>Paperclip::UploadedFileAdapter: Kim Crayton.jpg,:key=>"profiles/avatars/000/000/025/original/Kim_Crayton.jpg") AWS::S3::Errors::AccessDenied Access Denied
2016-02-03T23:32:29.989703+00:00 app[web.1]: [Rollbar] Reporting exception: Access Denied
2016-02-03T23:32:29.918738+00:00 app[web.1]:    (3.9ms)  BEGIN
2016-02-03T23:32:29.985462+00:00 app[web.1]:    (1.0ms)  ROLLBACK
2016-02-03T23:32:29.913438+00:00 app[web.1]:   Profile Load (1.0ms)  SELECT  "profiles".* FROM "profiles"  WHERE "profiles"."user_id" = $1 LIMIT 1  [["user_id", 32]]
2016-02-03T23:32:29.983374+00:00 app[web.1]:
2016-02-03T23:32:29.935107+00:00 app[web.1]: [paperclip] saving /profiles/avatars/000/000/025/original/Kim_Crayton.jpg
2016-02-03T23:32:29.920674+00:00 app[web.1]: Command :: file -b --mime '/tmp/7ad9d08462a928e43510aef94b436bb820160203-3-9amf8x.jpg'
2016-02-03T23:32:29.986839+00:00 app[web.1]: Completed 500 Internal Server Error in 1761ms
2016-02-03T23:32:30.038337+00:00 app[web.1]: [Rollbar] Sending payload
2016-02-03T23:32:30.035794+00:00 app[web.1]: [Rollbar] Scheduling payload
2016-02-03T23:32:30.297265+00:00 app[web.1]: [Rollbar] Success
2016-02-03T23:32:30.298549+00:00 app[web.1]: [Rollbar] Exception uuid saved in env: fe95e497-18b6-4711-8141-94789670b5ed
2016-02-03T23:32:30.312149+00:00 app[web.1]:   app/controllers/profiles_controller.rb:13:in `create'
2016-02-03T23:32:30.312147+00:00 app[web.1]: AWS::S3::Errors::AccessDenied (Access Denied):
2016-02-03T23:32:30.298468+00:00 app[web.1]: [Rollbar] Details: https://rollbar.com/instance/uuid?uuid=fe95e497-18b6-4711-8141-94789670b5ed (only available if report was successful)
2016-02-03T23:32:30.312144+00:00 app[web.1]:
2016-02-03T23:32:30.312149+00:00 app[web.1]:
2016-02-03T23:32:30.312150+00:00 app[web.1]:
2016-02-03T23:32:30.317622+00:00 heroku[router]: at=info method=POST path="/users/32/profile" host=www.jrdevmentoring.com request_id=6930043a-4007-4c13-9a38-0cac82aac0b6 fwd="108.80.140.163" dyno=web.1 connect=0ms service=4641ms status=500 bytes=1754
2016-02-03T23:41:43.818611+00:00 heroku[router]: at=info method=GET path="/" host=www.jrdevmentoring.com request_id=05a31e30-d8d1-465e-9a0d-4a545668949a fwd="107.206.188.61" dyno=web.1 connect=0ms service=58ms status=200 bytes=3069
2016-02-03T23:41:43.800534+00:00 app[web.1]: Started GET "/" for 107.206.188.61 at 2016-02-03 23:41:43 +0000
2016-02-03T23:41:43.808750+00:00 app[web.1]:   Plan Load (1.4ms)  SELECT  "plans".* FROM "plans"  WHERE "plans"."name" = 'mentor' LIMIT 1
2016-02-03T23:41:43.815175+00:00 app[web.1]: Completed 200 OK in 9ms (Views: 4.7ms | ActiveRecord: 2.0ms)
2016-02-03T23:41:43.812975+00:00 app[web.1]:   Rendered pages/home.html.erb within layouts/application (1.0ms)
2016-02-03T23:41:43.805782+00:00 app[web.1]: Processing by PagesController#home as HTML
2016-02-03T23:41:43.810095+00:00 app[web.1]:   Plan Load (0.6ms)  SELECT  "plans".* FROM "plans"  WHERE "plans"."name" = 'mentee' LIMIT 1
2016-02-03T23:41:43.814699+00:00 app[web.1]:   Rendered layouts/_header.html.erb (0.5ms)
2016-02-03T23:41:44.007715+00:00 heroku[router]: at=info method=GET path="/assets/application-ccf1b63ef283bc859fc20d775228d578.js" host=www.jrdevmentoring.com request_id=8a323d54-7eb3-4f09-bbb2-cc1f245654bf fwd="107.206.188.61" dyno=web.1 connect=1ms service=20ms status=200 bytes=142105
2016-02-03T23:41:44.113132+00:00 heroku[router]: at=info method=GET path="/assets/application-9750215382cdb39b0d4756e6b205dd25.css" host=www.jrdevmentoring.com request_id=198cd717-23b5-413d-8903-9d5f944884e0 fwd="107.206.188.61" dyno=web.1 connect=0ms service=23ms status=200 bytes=114067
AWS::S3::Errors::AccessDenied:拒绝访问文件“/app/app/controllers/profiles\u controller.rb”,创建中的第13行

完整跟踪:

2016-02-03T23:30:12.826846+00:00 app[web.1]:   Rendered pages/home.html.erb within layouts/application (1.3ms)
2016-02-03T23:30:12.830420+00:00 app[web.1]: Completed 200 OK in 9ms (Views: 6.1ms | ActiveRecord: 1.2ms)
2016-02-03T23:30:12.821127+00:00 app[web.1]: Processing by PagesController#home as HTML
2016-02-03T23:30:12.830151+00:00 app[web.1]:   Rendered layouts/_header.html.erb (0.9ms)
2016-02-03T23:30:12.824076+00:00 app[web.1]:   Plan Load (0.5ms)  SELECT  "plans".* FROM "plans"  WHERE "plans"."name" = 'mentee' LIMIT 1
2016-02-03T23:31:23.614411+00:00 app[web.1]: Processing by ProfilesController#create as HTML
2016-02-03T23:31:23.618346+00:00 app[web.1]:   User Load (1.3ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = 32  ORDER BY "users"."id" ASC LIMIT 1
2016-02-03T23:31:23.621171+00:00 app[web.1]:   CACHE (0.0ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = $1 LIMIT 1  [["id", "32"]]
2016-02-03T23:31:23.642828+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex6.jpg[0]' 2>/dev/null
2016-02-03T23:31:23.731583+00:00 app[web.1]: Command :: convert '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex6.jpg[0]' -auto-orient -resize "300x300>" '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex620160203-3-zkzzqj'
2016-02-03T23:31:23.610892+00:00 app[web.1]: Started POST "/users/32/profile" for 108.80.140.163 at 2016-02-03 23:31:23 +0000
2016-02-03T23:31:23.615000+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"ArxGVYON7jf+nRR9HfMcpHWxSgk4uHIw7ELCnDaJhvc=", "profile"=>{"not_available"=>"0", "first_name"=>"Kim", "last_name"=>"Crayton", "avatar"=>#<ActionDispatch::Http::UploadedFile:0x007fe496024c48 @tempfile=#<Tempfile:/tmp/RackMultipart20160203-3-1nmybbz>, @original_filename="Kim Crayton.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"profile[avatar]\"; filename=\"Kim Crayton.jpg\"\r\nContent-Type: image/jpeg\r\n">, "contact_email"=>"kimmcrayton@gmail.com", "city"=>"Atlanta", "state"=>"GA", "country"=>"USA", "coding_languages"=>"HTML, CSS, JavaScript, Python", "bio"=>"I was an educator, writer, and researcher in another life who decided to dive into the coding end of the pool. I've learned the basics on my own and like most who want to swim in the Olympics, I need a good coach to get me to the next level.", "mentoring_needs"=>"To be able to level up my skill set to become employed as a Jr. Developer"}, "commit"=>"Update Profile", "user_id"=>"32"}
2016-02-03T23:31:23.620344+00:00 app[web.1]:   User Load (0.8ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = $1 LIMIT 1  [["id", 32]]
2016-02-03T23:31:23.629345+00:00 app[web.1]: Command :: file -b --mime '/tmp/7ad9d08462a928e43510aef94b436bb820160203-3-1p8wtua.jpg'
2016-02-03T23:31:23.717450+00:00 app[web.1]: Command :: identify -format %m '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex6.jpg[0]'
2016-02-03T23:31:24.346558+00:00 app[web.1]: Command :: file -b --mime '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex620160203-3-zkzzqj'
2016-02-03T23:31:24.468671+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex6.jpg[0]' 2>/dev/null
2016-02-03T23:31:25.276211+00:00 app[web.1]: Command :: identify -format %m '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex6.jpg[0]'
2016-02-03T23:31:25.356070+00:00 app[web.1]: Command :: convert '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex6.jpg[0]' -auto-orient -resize "100x100>" '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex620160203-3-6j3feu'
2016-02-03T23:31:25.933442+00:00 app[web.1]: Command :: file -b --mime '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-oy7ex620160203-3-6j3feu'
2016-02-03T23:31:25.968535+00:00 app[web.1]:    (1.8ms)  BEGIN
2016-02-03T23:31:26.011723+00:00 app[web.1]:   SQL (1.9ms)  INSERT INTO "profiles" ("avatar_content_type", "avatar_file_name", "avatar_file_size", "avatar_updated_at", "bio", "city", "coding_languages", "contact_email", "country", "created_at", "first_name", "last_name", "mentoring_needs", "state", "updated_at", "user_id") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16) RETURNING "id"  [["avatar_content_type", "image/jpeg"], ["avatar_file_name", "Kim_Crayton.jpg"], ["avatar_file_size", 588778], ["avatar_updated_at", "2016-02-03 23:31:23.627122"], ["bio", "I was an educator, writer, and researcher in another life who decided to dive into the coding end of the pool. I've learned the basics on my own and like most who want to swim in the Olympics, I need a good coach to get me to the next level."], ["city", "Atlanta"], ["coding_languages", "HTML, CSS, JavaScript, Python"], ["contact_email", "kimmcrayton@gmail.com"], ["country", "USA"], ["created_at", "2016-02-03 23:31:26.002769"], ["first_name", "Kim"], ["last_name", "Crayton"], ["mentoring_needs", "To be able to level up my skill set to become employed as a Jr. Developer"], ["state", "GA"], ["updated_at", "2016-02-03 23:31:26.002769"], ["user_id", 32]]
2016-02-03T23:31:25.965320+00:00 app[web.1]:   Profile Load (8.5ms)  SELECT  "profiles".* FROM "profiles"  WHERE "profiles"."user_id" = $1 LIMIT 1  [["user_id", 32]]
2016-02-03T23:31:26.012791+00:00 app[web.1]: [paperclip] saving /profiles/avatars/000/000/024/original/Kim_Crayton.jpg
2016-02-03T23:31:25.972587+00:00 app[web.1]: Command :: file -b --mime '/tmp/7ad9d08462a928e43510aef94b436bb820160203-3-1fkobfh.jpg'
2016-02-03T23:31:26.192049+00:00 app[web.1]: [AWS S3 403 0.176059 0 retries] put_object(:acl=>:public_read,:bucket_name=>"BUCKET_NAME_VALUE",:content_length=>588778,:content_type=>"image/jpeg",:data=>Paperclip::UploadedFileAdapter: Kim Crayton.jpg,:key=>"profiles/avatars/000/000/024/original/Kim_Crayton.jpg") AWS::S3::Errors::AccessDenied Access Denied
2016-02-03T23:31:26.192052+00:00 app[web.1]:
2016-02-03T23:31:26.199059+00:00 app[web.1]:    (5.4ms)  ROLLBACK
2016-02-03T23:31:26.239693+00:00 app[web.1]: Completed 500 Internal Server Error in 2625ms
2016-02-03T23:31:26.278651+00:00 app[web.1]: [Rollbar] Scheduling payload
2016-02-03T23:31:26.278749+00:00 app[web.1]: [Rollbar] Sending payload
2016-02-03T23:31:26.255527+00:00 app[web.1]: [Rollbar] Reporting exception: Access Denied
2016-02-03T23:31:26.565131+00:00 heroku[router]: at=info method=POST path="/users/32/profile" host=www.jrdevmentoring.com request_id=39b4d6a4-de82-4746-bba2-15326511c36c fwd="108.80.140.163" dyno=web.1 connect=0ms service=5691ms status=500 bytes=1754
2016-02-03T23:31:26.556786+00:00 app[web.1]: [Rollbar] Success
2016-02-03T23:31:26.556867+00:00 app[web.1]: [Rollbar] Details: https://rollbar.com/instance/uuid?uuid=e2c97cca-326f-4501-a1ac-dabcedc8d047 (only available if report was successful)
2016-02-03T23:31:26.556955+00:00 app[web.1]: [Rollbar] Exception uuid saved in env: e2c97cca-326f-4501-a1ac-dabcedc8d047
2016-02-03T23:31:26.562072+00:00 app[web.1]:
2016-02-03T23:31:26.562074+00:00 app[web.1]:   app/controllers/profiles_controller.rb:13:in `create'
2016-02-03T23:31:26.562075+00:00 app[web.1]:
2016-02-03T23:31:26.562074+00:00 app[web.1]: AWS::S3::Errors::AccessDenied (Access Denied):
2016-02-03T23:31:26.562075+00:00 app[web.1]:
2016-02-03T23:32:23.939135+00:00 heroku[router]: at=info method=GET path="/users/32/profile/new" host=www.jrdevmentoring.com request_id=a926abfc-e512-42cc-bcf0-b49f0e660051 fwd="108.80.140.163" dyno=web.1 connect=0ms service=22ms status=304 bytes=844
2016-02-03T23:32:23.921568+00:00 app[web.1]:   Parameters: {"user_id"=>"32"}
2016-02-03T23:32:23.921563+00:00 app[web.1]: Processing by ProfilesController#new as HTML
2016-02-03T23:32:23.924214+00:00 app[web.1]:   User Load (0.8ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = 32  ORDER BY "users"."id" ASC LIMIT 1
2016-02-03T23:32:23.926869+00:00 app[web.1]:   CACHE (0.0ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = $1 LIMIT 1  [["id", "32"]]
2016-02-03T23:32:23.934672+00:00 app[web.1]:   Rendered profiles/_form.html.erb (5.2ms)
2016-02-03T23:32:23.934795+00:00 app[web.1]:   Rendered profiles/new.html.erb within layouts/mentee_layout (5.5ms)
2016-02-03T23:32:23.935958+00:00 app[web.1]:   Rendered layouts/_header.html.erb (0.4ms)
2016-02-03T23:32:23.919293+00:00 app[web.1]: Started GET "/users/32/profile/new" for 108.80.140.163 at 2016-02-03 23:32:23 +0000
2016-02-03T23:32:23.926294+00:00 app[web.1]:   User Load (1.0ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = $1 LIMIT 1  [["id", 32]]
2016-02-03T23:32:23.936324+00:00 app[web.1]: Completed 200 OK in 15ms (Views: 8.2ms | ActiveRecord: 2.5ms)
2016-02-03T23:32:23.928924+00:00 app[web.1]:   Plan Load (0.7ms)  SELECT  "plans".* FROM "plans"  WHERE "plans"."id" = $1 LIMIT 1  [["id", 30]]
2016-02-03T23:32:24.067025+00:00 heroku[router]: at=info method=GET path="/assets/application-ccf1b63ef283bc859fc20d775228d578.js" host=www.jrdevmentoring.com request_id=fd39d73a-d506-4b69-ac11-042db1ca8cee fwd="108.80.140.163" dyno=web.1 connect=0ms service=16ms status=304 bytes=133
2016-02-03T23:32:24.051947+00:00 heroku[router]: at=info method=GET path="/assets/application-9750215382cdb39b0d4756e6b205dd25.css" host=www.jrdevmentoring.com request_id=7f1972d5-75f3-469c-9672-2d149981a9b9 fwd="108.80.140.163" dyno=web.1 connect=0ms service=8ms status=304 bytes=133
2016-02-03T23:32:28.231345+00:00 app[web.1]:   User Load (0.6ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = $1 LIMIT 1  [["id", 32]]
2016-02-03T23:32:28.222520+00:00 app[web.1]: Started POST "/users/32/profile" for 108.80.140.163 at 2016-02-03 23:32:28 +0000
2016-02-03T23:32:28.367338+00:00 app[web.1]: Command :: identify -format %m '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf.jpg[0]'
2016-02-03T23:32:28.240793+00:00 app[web.1]: Command :: file -b --mime '/tmp/7ad9d08462a928e43510aef94b436bb820160203-3-133toy1.jpg'
2016-02-03T23:32:28.225432+00:00 app[web.1]: Processing by ProfilesController#create as HTML
2016-02-03T23:32:28.225555+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"ArxGVYON7jf+nRR9HfMcpHWxSgk4uHIw7ELCnDaJhvc=", "profile"=>{"not_available"=>"0", "first_name"=>"Kim", "last_name"=>"Crayton", "avatar"=>#<ActionDispatch::Http::UploadedFile:0x007fe496024c48 @tempfile=#<Tempfile:/tmp/RackMultipart20160203-3-spce1k>, @original_filename="Kim Crayton.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"profile[avatar]\"; filename=\"Kim Crayton.jpg\"\r\nContent-Type: image/jpeg\r\n">, "contact_email"=>"kimmcrayton@gmail.com", "city"=>"Atlanta", "state"=>"GA", "country"=>"USA", "coding_languages"=>"HTML, CSS, JavaScript, Python", "bio"=>"I was an educator, writer, and researcher in another life who decided to dive into the coding end of the pool. I've learned the basics on my own and like most who want to swim in the Olympics, I need a good coach to get me to the next level.", "mentoring_needs"=>"To be able to level up my skill set to become employed as a Jr. Developer"}, "commit"=>"Update Profile", "user_id"=>"32"}
2016-02-03T23:32:28.229747+00:00 app[web.1]:   User Load (1.7ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = 32  ORDER BY "users"."id" ASC LIMIT 1
2016-02-03T23:32:28.232006+00:00 app[web.1]:   CACHE (0.0ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = $1 LIMIT 1  [["id", "32"]]
2016-02-03T23:32:28.411553+00:00 app[web.1]: Command :: convert '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf.jpg[0]' -auto-orient -resize "300x300>" '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf20160203-3-bep14i'
2016-02-03T23:32:28.254571+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf.jpg[0]' 2>/dev/null
2016-02-03T23:32:29.005396+00:00 app[web.1]: Command :: file -b --mime '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf20160203-3-bep14i'
2016-02-03T23:32:29.215235+00:00 app[web.1]: Command :: identify -format %m '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf.jpg[0]'
2016-02-03T23:32:29.042851+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf.jpg[0]' 2>/dev/null
2016-02-03T23:32:29.254140+00:00 app[web.1]: Command :: convert '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf.jpg[0]' -auto-orient -resize "100x100>" '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf20160203-3-18abmic'
2016-02-03T23:32:29.899670+00:00 app[web.1]: Command :: file -b --mime '/tmp/907d62dfd370e834d14b2f9e69569f8f20160203-3-150cqxf20160203-3-18abmic'
2016-02-03T23:32:29.934163+00:00 app[web.1]:   SQL (1.0ms)  INSERT INTO "profiles" ("avatar_content_type", "avatar_file_name", "avatar_file_size", "avatar_updated_at", "bio", "city", "coding_languages", "contact_email", "country", "created_at", "first_name", "last_name", "mentoring_needs", "state", "updated_at", "user_id") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16) RETURNING "id"  [["avatar_content_type", "image/jpeg"], ["avatar_file_name", "Kim_Crayton.jpg"], ["avatar_file_size", 588778], ["avatar_updated_at", "2016-02-03 23:32:28.238610"], ["bio", "I was an educator, writer, and researcher in another life who decided to dive into the coding end of the pool. I've learned the basics on my own and like most who want to swim in the Olympics, I need a good coach to get me to the next level."], ["city", "Atlanta"], ["coding_languages", "HTML, CSS, JavaScript, Python"], ["contact_email", "kimmcrayton@gmail.com"], ["country", "USA"], ["created_at", "2016-02-03 23:32:29.931498"], ["first_name", "Kim"], ["last_name", "Crayton"], ["mentoring_needs", "To be able to level up my skill set to become employed as a Jr. Developer"], ["state", "GA"], ["updated_at", "2016-02-03 23:32:29.931498"], ["user_id", 32]]
2016-02-03T23:32:29.983370+00:00 app[web.1]: [AWS S3 403 0.044695 0 retries] put_object(:acl=>:public_read,:bucket_name=>"BUCKET_NAME_VALUE",:content_length=>588778,:content_type=>"image/jpeg",:data=>Paperclip::UploadedFileAdapter: Kim Crayton.jpg,:key=>"profiles/avatars/000/000/025/original/Kim_Crayton.jpg") AWS::S3::Errors::AccessDenied Access Denied
2016-02-03T23:32:29.989703+00:00 app[web.1]: [Rollbar] Reporting exception: Access Denied
2016-02-03T23:32:29.918738+00:00 app[web.1]:    (3.9ms)  BEGIN
2016-02-03T23:32:29.985462+00:00 app[web.1]:    (1.0ms)  ROLLBACK
2016-02-03T23:32:29.913438+00:00 app[web.1]:   Profile Load (1.0ms)  SELECT  "profiles".* FROM "profiles"  WHERE "profiles"."user_id" = $1 LIMIT 1  [["user_id", 32]]
2016-02-03T23:32:29.983374+00:00 app[web.1]:
2016-02-03T23:32:29.935107+00:00 app[web.1]: [paperclip] saving /profiles/avatars/000/000/025/original/Kim_Crayton.jpg
2016-02-03T23:32:29.920674+00:00 app[web.1]: Command :: file -b --mime '/tmp/7ad9d08462a928e43510aef94b436bb820160203-3-9amf8x.jpg'
2016-02-03T23:32:29.986839+00:00 app[web.1]: Completed 500 Internal Server Error in 1761ms
2016-02-03T23:32:30.038337+00:00 app[web.1]: [Rollbar] Sending payload
2016-02-03T23:32:30.035794+00:00 app[web.1]: [Rollbar] Scheduling payload
2016-02-03T23:32:30.297265+00:00 app[web.1]: [Rollbar] Success
2016-02-03T23:32:30.298549+00:00 app[web.1]: [Rollbar] Exception uuid saved in env: fe95e497-18b6-4711-8141-94789670b5ed
2016-02-03T23:32:30.312149+00:00 app[web.1]:   app/controllers/profiles_controller.rb:13:in `create'
2016-02-03T23:32:30.312147+00:00 app[web.1]: AWS::S3::Errors::AccessDenied (Access Denied):
2016-02-03T23:32:30.298468+00:00 app[web.1]: [Rollbar] Details: https://rollbar.com/instance/uuid?uuid=fe95e497-18b6-4711-8141-94789670b5ed (only available if report was successful)
2016-02-03T23:32:30.312144+00:00 app[web.1]:
2016-02-03T23:32:30.312149+00:00 app[web.1]:
2016-02-03T23:32:30.312150+00:00 app[web.1]:
2016-02-03T23:32:30.317622+00:00 heroku[router]: at=info method=POST path="/users/32/profile" host=www.jrdevmentoring.com request_id=6930043a-4007-4c13-9a38-0cac82aac0b6 fwd="108.80.140.163" dyno=web.1 connect=0ms service=4641ms status=500 bytes=1754
2016-02-03T23:41:43.818611+00:00 heroku[router]: at=info method=GET path="/" host=www.jrdevmentoring.com request_id=05a31e30-d8d1-465e-9a0d-4a545668949a fwd="107.206.188.61" dyno=web.1 connect=0ms service=58ms status=200 bytes=3069
2016-02-03T23:41:43.800534+00:00 app[web.1]: Started GET "/" for 107.206.188.61 at 2016-02-03 23:41:43 +0000
2016-02-03T23:41:43.808750+00:00 app[web.1]:   Plan Load (1.4ms)  SELECT  "plans".* FROM "plans"  WHERE "plans"."name" = 'mentor' LIMIT 1
2016-02-03T23:41:43.815175+00:00 app[web.1]: Completed 200 OK in 9ms (Views: 4.7ms | ActiveRecord: 2.0ms)
2016-02-03T23:41:43.812975+00:00 app[web.1]:   Rendered pages/home.html.erb within layouts/application (1.0ms)
2016-02-03T23:41:43.805782+00:00 app[web.1]: Processing by PagesController#home as HTML
2016-02-03T23:41:43.810095+00:00 app[web.1]:   Plan Load (0.6ms)  SELECT  "plans".* FROM "plans"  WHERE "plans"."name" = 'mentee' LIMIT 1
2016-02-03T23:41:43.814699+00:00 app[web.1]:   Rendered layouts/_header.html.erb (0.5ms)
2016-02-03T23:41:44.007715+00:00 heroku[router]: at=info method=GET path="/assets/application-ccf1b63ef283bc859fc20d775228d578.js" host=www.jrdevmentoring.com request_id=8a323d54-7eb3-4f09-bbb2-cc1f245654bf fwd="107.206.188.61" dyno=web.1 connect=1ms service=20ms status=200 bytes=142105
2016-02-03T23:41:44.113132+00:00 heroku[router]: at=info method=GET path="/assets/application-9750215382cdb39b0d4756e6b205dd25.css" host=www.jrdevmentoring.com request_id=198cd717-23b5-413d-8903-9d5f944884e0 fwd="107.206.188.61" dyno=web.1 connect=0ms service=23ms status=200 bytes=114067
profile.rb

class Profile < ActiveRecord::Base
  belongs_to :user

  validates :first_name, presence: true
  validates :last_name, presence: true
  validates :contact_email, presence: true
  validates :bio, presence: true
  validates :mentoring_needs, presence: true
  validates_length_of :coding_languages,  minimum: 1, maximum: 500
  validates_length_of :bio,  minimum: 1, maximum: 1000
  validates_length_of :mentoring_needs,  minimum: 1, maximum: 500

  has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
  validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/
end
类配置文件{:medium=>“300x300>”,:thumb=>“100x100>”},:default\u url=>“/images/:style/missing.png”
验证\u附件\u内容\u类型:头像,:内容\u类型=>/\Aimage\/.\Z/
结束
如用户手册中所述


您需要将AWS凭据设置为heroku中的配置变量(基本上是环境变量)。您可以检查它们是否设置了heroku配置;如果未设置它们,您可以使用heroku config:set S3\u BUCKET\u NAME=something AWS\u ACCESS\u KEY\u ID=which AWS\u SECRET\u ACCESS\u KEY=something\u SECRET添加它们。heroku配置的更多信息--帮助


在AWS改变策略要求IAM用户后,我也遇到了同样的问题。我创建了新的IAM用户并收到了IAM用户的新凭据,在使用新凭据更新我的应用程序后,我收到了相同的错误。我通过返回AWS、服务、IAM用户并为用户创建管理员访问权限来修复它。

哪一行是第13行?S3连接在哪里?显然,您使用Heroku是因为它在您的标记中,但是您的环境变量设置了吗?请提供更多关于你的情况的信息,因为其他人已经有了,所以不允许我编辑。第13行:如果@profile.save,我想你就是那个人是的,我编辑它是为了改进格式和问题标题。您可以进行其他编辑,尽管您需要将AWS凭据设置为heroku中的配置变量(基本上是环境变量)。您可以检查它们是否设置为
heroku config
;如果未设置它们,您可以使用heroku config:set S3\u BUCKET\u NAME=something AWS\u ACCESS\u KEY\u ID=which AWS\u SECRET\u ACCESS\u KEY=something\u SECRET添加它们。有关heroku config--help的更多信息,请参见。您可以接受自己的答案,因为问题提出已经48小时了。我已经为你在这里引用的评论附上了引文。为了使这篇文章更具信息性,也许你也可以编辑使用这种方法的工作内容,这样那些在将来找到这篇文章的人将有更好的机会解决他们的问题。
class Profile < ActiveRecord::Base
  belongs_to :user

  validates :first_name, presence: true
  validates :last_name, presence: true
  validates :contact_email, presence: true
  validates :bio, presence: true
  validates :mentoring_needs, presence: true
  validates_length_of :coding_languages,  minimum: 1, maximum: 500
  validates_length_of :bio,  minimum: 1, maximum: 1000
  validates_length_of :mentoring_needs,  minimum: 1, maximum: 500

  has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
  validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/
end