Forum: Ruby on Rails access key error

Posted by Saravanan P (Guest)
on 2012-09-13 09:54
(Received via mailing list)
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.):
Posted by Colin Law (Guest)
on 2012-09-13 10:03
(Received via mailing list)
On 13 September 2012 08:53, Saravanan P <saravanan.p@shriramits.com> 
wrote:
> 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
Posted by Saravanan P (Guest)
on 2012-09-13 10:08
(Received via mailing list)
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.


On Thu, Sep 13, 2012 at 1:31 PM, Colin Law <clanlaw@googlemail.com> 
wrote:

>
>
>


--
Regards by
Saravanan.P
Posted by Jim ruther Nill (jimboker)
on 2012-09-13 10:16
(Received via mailing list)
On Thu, Sep 13, 2012 at 6:07 PM, Saravanan P 
<saravanan.p@shriramits.com>wrote:

> /system/:attachment/:id/:style/:filename. This will clash with attachment
> `companies` WHERE (name IN ('Fresh goat cheese','Scallops','Maine
> `pictures` WHERE `pictures`.`imageable_type` = 'Product' AND
> `advertisements` ORDER BY created_at desc LIMIT 1
>     268:
> "?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-insta...


>> >
>> You received this message because you are subscribed to the Google Groups
> --
>
>
>



--
Posted by Saravanan P (Guest)
on 2012-09-13 11:20
(Received via mailing list)
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


On Thu, Sep 13, 2012 at 1:44 PM, Jim Ruther Nill <jvnill@gmail.com> 
wrote:

>>   [1m [36mProduct Load (1.3ms) [0m   [1mSELECT id, product_type, name,
>>   [1m [35mPicture Load (12.3ms) [0m  SELECT `pictures`.* FROM `pictures`
>> 84, 51, 120, 154, 103, 37, 56, 130, 148) [0m
>> [paperclip] Duplicate URL for attachment with
>>
>>     271:                 .ic_caption{:style => "display: block;"}
>
>>
>>>
>>> rubyonrails-talk+unsubscribe@googlegroups.com.
>>  --
>
> rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



--
Regards by
Saravanan.P
Posted by Saravanan P (Guest)
on 2012-09-13 17:02
(Received via mailing list)
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... :(

please help

On Thu, Sep 13, 2012 at 2:49 PM, Saravanan P 
<saravanan.p@shriramits.com>wrote:

>   :s3_protocol => 'https',
>     bucket: my_avatar-test
>
>>>   [1m [36mProduct Load (1.3ms) [0m   [1mSELECT id, product_type, name,
>>>   [1m [35mPicture Load (12.3ms) [0m  SELECT `pictures`.* FROM `pictures`
>>> 84, 51, 120, 154, 103, 37, 56, 130, 148) [0m
>>> [paperclip] Duplicate URL for attachment with
>>>
>>>     271:                 .ic_caption{:style => "display: block;"}
>>
>>>
>>>>
>>>> rubyonrails-talk+unsubscribe@googlegroups.com.
>>>  --
>>
>> rubyonrails-talk+unsubscribe@googlegroups.com.
>
>


--
Regards by
Saravanan.P
Posted by Jim ruther Nill (jimboker)
on 2012-09-13 17:24
(Received via mailing list)
On Fri, Sep 14, 2012 at 1:01 AM, Saravanan P 
<saravanan.p@shriramits.com>wrote:

> 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... :(


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.


>>  has_attached_file :crop_content, :styles => {:thumb =>
>> development:
>>     bucket: my_avatar-production
>>>
>>>> /system/:attachment/:id/:style/:filename. This will clash with attachment
>>>> `companies` WHERE (name IN ('Fresh goat cheese','Scallops','Maine
>>>>   [1m [36mPicture Load (1.3ms) [0m   [1mSELECT `pictures`.* FROM
>>>>   [1m [35mAdvertisement Load (0.2ms) [0m  SELECT `advertisements`.*
>>>>     267:             .img_col1
>>>>     273:                     %a{:href => "/product_details" +
>>>
>>>>
>>>>>
>>>>>
>>>> Groups "Ruby on Rails: Talk" group.
>>> --
>>>
>
> rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



--
Posted by Saravanan P (Guest)
on 2012-09-13 18:02
(Received via mailing list)
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.


On Thu, Sep 13, 2012 at 8:53 PM, Jim Ruther Nill <jvnill@gmail.com> 
wrote:

> paperclip parses those credentials
>
>>>
>>>
>>> production:
>>>> saravanan.p@shriramits.com> wrote:
>>>>> [paperclip] Duplicate URL for attachment with
>>>>>   [1m [36mCompany Load (1.0ms) [0m   [1mSELECT `companies`.* FROM
>>>>> `categories` WHERE `categories`.`id` IN (14, 5, 13, 9, 2, 0, 7, 4, 17)
>>>>> defined in Category class
>>>>> keys. Please provide the access_key_id and the secret_access_key.):
>>>>>     272:                   .overlay-text
>>>> for the complete error tells you this.
>>>>> On Thu, Sep 13, 2012 at 1:31 PM, Colin Law <clanlaw@googlemail.com>wrote:
>>>>>> that generates the error.
>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>> You received this message because you are subscribed to the Google
>>>>
>>>> rubyonrails-talk+unsubscribe@googlegroups.com.
>>>
>> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> -------------------------------------------------------------
>
>



--
Regards by
Saravanan.P
Posted by Jim ruther Nill (jimboker)
on 2012-09-13 18:10
(Received via mailing list)
On Fri, Sep 14, 2012 at 2:00 AM, Saravanan P 
<saravanan.p@shriramits.com>wrote:

>
> 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.


>>> images. May be some other error... :(
>> "329" , :height =>"251"}
>>> > wrote:
>>>> => 10.years.from_now.httpdate },
>>>> test:
>>>> On Thu, Sep 13, 2012 at 1:44 PM, Jim Ruther Nill <jvnill@gmail.com>wrote:
>>>>>> Started GET "/" for 122.183.133.1 at 2012-09-13 07:38:52 +0000
>>>>>>   [1m [36mCategory Load (1.0ms) [0m   [1mSELECT `categories`.* FROM
>>>>>>   [1m [36mCategoryImage Load (0.6ms) [0m   [1mSELECT
>>>>>> `thoughts` ORDER BY created_at DESC LIMIT 1
>>>>>> BY created_at DESC LIMIT 1
>>>>>>     270:                   %img{:alt =>
>>>>>>   app/views/home/index.html.haml:262:in
>>>>>>
>>>>>>> > ActionView::Template::Error (You did not provide both required
>>>>>>> Groups "Ruby on Rails: Talk" group.
>>>>>> --
>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>  --
>>>>
>>> Regards by
>>>
>> "Ruby on Rails: Talk" group.
> --
>
>
>



--
Posted by Colin Law (Guest)
on 2012-09-13 18:32
(Received via mailing list)
On 13 September 2012 17:00, Saravanan P <saravanan.p@shriramits.com> 
wrote:
> 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
Posted by Colin Law (Guest)
on 2012-09-13 18:37
(Received via mailing list)
On 13 September 2012 17:30, Colin Law <clanlaw@googlemail.com> wrote:
> On 13 September 2012 17:00, Saravanan P <saravanan.p@shriramits.com> wrote:
>> 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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.