access key error

I am getting following error while run my rails app in my server

ActionView::Template::Error (You did not provide both required access keys. Please provide the access_key_id and the secret_access_key.):

I think you may need to give us some more information about the code
that generates the error.

Colin

Thanks for the reply.

This is from my .log file

Started GET “/” for 122.183.133.1 at 2012-09-13 07:38:52 +0000

Processing by HomeController#index as HTML

[1m[36mProduct Load (1.3ms)[0m [1mSELECT id, product_type, name, slug, short_description, price, farm_name, lbcount, unit FROM products WHERE (featured_product=1) ORDER BY rand() LIMIT 20[0m

[paperclip] Duplicate URL for attachment with /system/:attachment/:id/:style/:filename. This will clash with attachment defined in Advertisement class

[1m[35mCategoryImage Load (0.9ms)[0m SELECT category_images.* FROM category_images WHERE category_images.product_id IN (43, 40, 88, 54, 158, 150, 57, 70, 109)

[1m[36mCategory Load (1.0ms)[0m [1mSELECT categories.* FROM categories WHERE categories.id IN (8, 2, 4, 9, 5, 10, 11, 6)[0m

[1m[35mPicture Load (12.3ms)[0m SELECT pictures.* FROM pictures WHERE pictures.imageable_type = ‘Product’ AND pictures.imageable_id IN (43, 40, 88, 54, 158, 150, 57, 70, 109)

[1m[36mCompany Load (1.0ms)[0m [1mSELECT companies.* FROM companies WHERE (name IN (‘Fresh goat cheese’,‘Scallops’,‘Maine lobsters’,‘Fresh peaches’,‘Teas’)) ORDER BY rand()[0m

[1m[35mProduct Load (0.7ms)[0m SELECT id, product_type, name, slug, short_description, price, farm_name, lbcount, unit FROM products WHERE (featured_product = 0 and new_product= 1) ORDER BY rand() LIMIT 20

[1m[36mCategoryImage Load (0.6ms)[0m [1mSELECT category_images.* FROM category_images WHERE category_images.product_id IN (119, 31, 84, 51, 120, 154, 103, 37, 56, 130, 148)[0m

[1m[35mCategory Load (0.6ms)[0m SELECT categories.* FROM categories WHERE categories.id IN (14, 5, 13, 9, 2, 0, 7, 4, 17)

[1m[36mPicture Load (1.3ms)[0m [1mSELECT pictures.* FROM pictures WHERE pictures.imageable_type = ‘Product’ AND pictures.imageable_id IN (119, 31, 84, 51, 120, 154, 103, 37, 56, 130, 148)[0m

[1m[35mThought Load (0.2ms)[0m SELECT thoughts.* FROM thoughts ORDER BY created_at DESC LIMIT 1

[1m[36mLearn Load (0.2ms)[0m [1mSELECT learns.* FROM learns ORDER BY created_at DESC LIMIT 2[0m

[paperclip] Duplicate URL for attachment with /system/:attachment/:id/:style/:filename. This will clash with attachment defined in Category class

[1m[35mAdvertisement Load (0.2ms)[0m SELECT advertisements.* FROM advertisements ORDER BY created_at desc LIMIT 1

[1m[36mNews Load (0.2ms)[0m [1mSELECT news.* FROM news ORDER BY created_at DESC LIMIT 1[0m

[1m[35mBlog Load (0.2ms)[0m SELECT blogs.* FROM blogs ORDER BY created_at DESC LIMIT 1

Rendered home/index.html.haml within layouts/application (3.0ms)

Completed 500 Internal Server Error in 359ms

ActionView::Template::Error (You did not provide both required access keys. Please provide the access_key_id and the secret_access_key.):

267: .img_col1

268: .capslide_img_cont1.ic_container{:style=>“position:absolute;”}

269: %a{:href => “/product_details” + “?category_id=#{@cate.category.slug}” + "&product_id=#{x.slug} "}

270: %img{:alt => “product”,:src=>"#{i.image.url(:products)}", :width => “329” , :height =>“251”}

271: .ic_caption{:style => “display: block;”}

272: .overlay-text

273: %a{:href => “/product_details” + “?category_id=#{@cate.category.slug}” + "&product_id=#{x.slug} "}

app/views/home/index.html.haml:270:in `block in _app_views_home_index_html_haml___1026580395_93166550’

app/views/home/index.html.haml:262:in `each’

app/views/home/index.html.haml:262:in `_app_views_home_index_html_haml___1026580395_93166550’

Note: Some of the page running which looks like static page content.

Thanks for the reply.

This is from my .log file

Started GET “/” for 122.183.133.1 at 2012-09-13 07:38:52 +0000

Processing by HomeController#index as HTML

[1m [36mProduct Load (1.3ms) [0m [1mSELECT id, product_type, name, slug, short_description, price, farm_name, lbcount, unit FROM products WHERE (featured_product=1) ORDER BY rand() LIMIT 20 [0m

[paperclip] Duplicate URL for attachment with /system/:attachment/:id/:style/:filename. This will clash with attachment defined in Advertisement class

[1m [35mCategoryImage Load (0.9ms) [0m SELECT category_images.* FROM category_images WHERE category_images.product_id IN (43, 40, 88, 54, 158, 150, 57, 70, 109)

[1m [36mCategory Load (1.0ms) [0m [1mSELECT categories.* FROM categories WHERE categories.id IN (8, 2, 4, 9, 5, 10, 11, 6) [0m

[1m [35mPicture Load (12.3ms) [0m SELECT pictures.* FROM pictures WHERE pictures.imageable_type = ‘Product’ AND pictures.imageable_id IN (43, 40, 88, 54, 158, 150, 57, 70, 109)

[1m [36mCompany Load (1.0ms) [0m [1mSELECT companies.* FROM companies WHERE (name IN (‘Fresh goat cheese’,‘Scallops’,‘Maine lobsters’,‘Fresh peaches’,‘Teas’)) ORDER BY rand() [0m

[1m [35mProduct Load (0.7ms) [0m SELECT id, product_type, name, slug, short_description, price, farm_name, lbcount, unit FROM products WHERE (featured_product = 0 and new_product= 1) ORDER BY rand() LIMIT 20

[1m [36mCategoryImage Load (0.6ms) [0m [1mSELECT category_images.* FROM category_images WHERE category_images.product_id IN (119, 31, 84, 51, 120, 154, 103, 37, 56, 130, 148) [0m

[1m [35mCategory Load (0.6ms) [0m SELECT categories.* FROM categories WHERE categories.id IN (14, 5, 13, 9, 2, 0, 7, 4, 17)

[1m [36mPicture Load (1.3ms) [0m [1mSELECT pictures.* FROM pictures WHERE pictures.imageable_type = ‘Product’ AND pictures.imageable_id IN (119, 31, 84, 51, 120, 154, 103, 37, 56, 130, 148) [0m

[1m [35mThought Load (0.2ms) [0m SELECT thoughts.* FROM thoughts ORDER BY created_at DESC LIMIT 1

[1m [36mLearn Load (0.2ms) [0m [1mSELECT learns.* FROM learns ORDER BY created_at DESC LIMIT 2 [0m

[paperclip] Duplicate URL for attachment with /system/:attachment/:id/:style/:filename. This will clash with attachment defined in Category class

[1m [35mAdvertisement Load (0.2ms) [0m SELECT advertisements.* FROM advertisements ORDER BY created_at desc LIMIT 1

[1m [36mNews Load (0.2ms) [0m [1mSELECT news.* FROM news ORDER BY created_at DESC LIMIT 1 [0m

[1m [35mBlog Load (0.2ms) [0m SELECT blogs.* FROM blogs ORDER BY created_at DESC LIMIT 1

Rendered home/index.html.haml within layouts/application (3.0ms)

Completed 500 Internal Server Error in 359ms

ActionView::Template::Error (You did not provide both required access keys. Please provide the access_key_id and the secret_access_key.):

267: .img_col1

268: .capslide_img_cont1.ic_container{:style=>“position:absolute;”}

269: %a{:href => “/product_details” + “?category_id=#{@cate.category.slug}” + "&product_id=#{x.slug} "}

270: %img{:alt => “product”,:src=>"#{i.image.url(:products)}", :width => “329” , :height =>“251”}

271: .ic_caption{:style => “display: block;”}

272: .overlay-text

273: %a{:href => “/product_details” + “?category_id=#{@cate.category.slug}” + "&product_id=#{x.slug} "}

app/views/home/index.html.haml:270:in `block in _app_views_home_index_html_haml___1026580395_93166550’

app/views/home/index.html.haml:262:in `each’

app/views/home/index.html.haml:262:in `_app_views_home_index_html_haml___1026580395_93166550’

Looks like it has something to do with you s3 credentials. Searching for the complete error tells you this.

https://www.google.com/webhp?sourceid=chrome-instant&ie=UTF-8#hl=en&safe=off&sclient=psy-ab&q=%22You+did+not+provide+both+required+access+keys.+Please+provide+the+access_key_id+and+the+secret_access_key%22&oq=%22You+did+not+provide+both+required+access+keys.+Please+provide+the+access_key_id+and+the+secret_access_key%22&gs_l=hp.3…2428.3001.1.3258.2.2.0.0.0.0.0.0…0.0…0.2…1c.1.ywAFlQv0Z_s&pbx=1&fp=1&biw=1366&bih=622&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&cad=b

I provide all keys but not working. In development working well

In my model

has_attached_file :crop_content, :styles => {:thumb => “89x75#”,:crop_content=>“160x160#” },

:path => “assets/crops/contents/:id/:style/:basename.:extension”,

:storage => “s3”,

#:s3_headers => { ‘Cache-Control’ => ‘max-age=315576000’, ‘Expires’ => 10.years.from_now.httpdate },

:s3_protocol => ‘https’,

:s3_credentials => “#{::Rails.root.to_s}/config/amazon-s3.yml”

and under config folder/amazon-s3.yml

development:

bucket: my_avatar-production

access_key_id: amazonaccesskey

secret_access_key: amazon_secret_access_key

test:

bucket: my_avatar-test

access_key_id: amazonaccesskey

secret_access_key: amazon_secret_access_key

production:

bucket: my_avatar-production

access_key_id: amazonaccesskey

secret_access_key: amazon_secret_access_key

i don’t think error be in my amazon s3 access key. Because as i mentioned earlier some of page was running and that pages having s3 images. May be some other error… :frowning:

please help

i don’t think error be in my amazon s3 access key. Because as i mentioned earlier some of page was running and that pages having s3 images. May be some other error… :frowning:

I’m pretty sure it has something to do with the credentials or how paperclip parses those credentials

what does this code return? Model.attachment_definitions[:image][:s3_credentials]

I have one more question. On line 270 of the code you pasted

%img{:alt => “product”,:src=>"#{i.image.url(:products)}", :width => “329” , :height =>“251”}

look at the class of whatever ‘i’ is, particularly the s3_credentials option you passed for that model.

ok if my s3_credentials is problem mean, i can able to see app-logo which stored in s3 in my about-us page.

and for

%img{:alt => “product”,:src=>"#{i.image.url(:products)}", :width => “329” , :height =>“251”}

look at the class of whatever ‘i’ is, particularly the s3_credentials option you passed for that model.

its returning correct url for the product image which stored in s3 in my production.

ok if my s3_credentials is problem mean, i can able to see app-logo which stored in s3 in my about-us page.

and for

%img{:alt => “product”,:src=>"#{i.image.url(:products)}", :width => “329” , :height =>“251”}

look at the class of whatever ‘i’ is, particularly the s3_credentials option you passed for that model.

its returning correct url for the product image which stored in s3 in my production.

ok. i’m basing all of what I said from the logs that you pasted. Since you are very sure that line 270 is not the cause

of the error, I don’t have any idea what else could be wrong. try removing each line/block of code on the view

one by one to filter out the line that’s causing the error. once you get the offending line, you should be able to

figure out what’s wrong.

ok if my s3_credentials is problem mean, i can able to see app-logo which
stored in s3 in my about-us page.

and for

%img{:alt => "product",:src=>"#{i.image.url(:products)}", :width => "329" ,
:height =>"251"}

Should that be :src => "/"#{i.image.url(:products)}/""

Colin

ok if my s3_credentials is problem mean, i can able to see app-logo which
stored in s3 in my about-us page.

and for

%img{:alt => "product",:src=>"#{i.image.url(:products)}", :width => "329" ,
:height =>"251"}

Should that be :src => "/"#{i.image.url(:products)}/""

Ah, no I see that haml puts the quotes in for you.

Colin