lines-engine icon indicating copy to clipboard operation
lines-engine copied to clipboard

Missing required option :name when trying to use S3 for storage.

Open jfacoustic opened this issue 5 years ago • 2 comments

I've been trying to get my blog set up on Heroku in S3. I followed issue #16, but this is as far as I got.
I've also been following Heroku's instructions for setting up Rails with S3.

I was testing this with heroku local:run rails s to get the error.
I tried pushing to my website and it didn't work either.

ArgumentError in Lines::Articles#index missing required option :name

  <div class="article <%= article_class %>">
  <% cache "#{article_small}_small" do %>
    <% unless article_small.image_url.blank? %> #This is where the error is marked.
      <div class="hero_image">
        <%= link_to article_path(article_small) do %>
          <img src="<%= article_small.image_url %>" alt="<%= article_small.title %>" />

The top of my framework trace says aws-sdk-s3 (1.30.1) lib/aws-sdk-s3/bucket.rb:684:in extract_name

Thanks for your help :)

jfacoustic avatar Jan 24 '19 00:01 jfacoustic

Install byebug gem and put a debugger statement above the line that gives error. Then press n in the console to follow where the :name is required for.

adonespitogo avatar Jan 24 '19 04:01 adonespitogo

You need to provide a bucket name. I was able to get this working with the following config in an initializer:

CarrierWave.configure do |config|
  config.aws_bucket =  ENV['AWS_BUCKET']
  config.aws_credentials = {
    access_key_id:     ENV['AWS_ACCESS_KEY_ID'],
    secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
    region:            'us-west-1'
  }
end

jeremykirc avatar Aug 12 '21 17:08 jeremykirc