Reputation: 12683
As the title suggests, I'm using paperclip and S3 with Rails. When I try to create a record that has an image, I get this error:
[paperclip] saving interactives/5/images/original/Havaneser_Anton.jpg
(6.6ms) ROLLBACK
Completed 500 Internal Server Error in 2021ms (ActiveRecord: 86.8ms)
Aws::S3::Errors::InvalidArgument ():
I don't know what's going on, other than "It's not working"...
Here is my development.rb
configuration:
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.paperclip_defaults = {
storage: :s3,
s3_permissions: :public,
s3_region: ENV['AWS_REGION'],
s3_credentials: {
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
bucket: ENV['AWS_S3_BUCKET']
},
s3_protocol: 'https',
s3_host_name: "s3-#{ENV['AWS_REGION']}.amazonaws.com",
path: ":class/:id/:attachment/:style/:filename"
}
My Model looks like this:
class Interactive < ApplicationRecord
belongs_to :project
has_attached_file :image, styles: { low_res: "10%", medium: "300x300>", thumb: "300x250>" }, default_url: "/images/:style/missing.png"
validates_attachment_content_type :image, content_type: /\Aimage\/.*\z/
Upvotes: 1
Views: 464