Hey guys , I need your help adding paperclip + sol...
# support
c
Hey guys , I need your help adding paperclip + solidus I add this for
initializer/spree.rb
Copy code
config.image_attachment_module = 'Spree::Image::PaperclipAttachment'
  config.taxon_attachment_module = 'Spree::Taxon::PaperclipAttachment'
then i create a paperclip file with this config
Copy code
# config/initializers/paperclip.rb
if Rails.application.credentials.dig(:aws, :access_key_id)
  attachment_config = {
    s3_credentials: {
      access_key_id: Rails.application.credentials.dig(:aws, :access_key_id),
      secret_access_key: Rails.application.credentials.dig(:aws, :secret_access_key),
      bucket: Rails.application.credentials.dig(:aws, :bucket_name),
      s3_region: 'us-east-1',
    },

    storage:        :s3,
    s3_headers:     { "Cache-Control" => "max-age=31557600" },
    s3_protocol:    "https",
    # url:            ':s3_alias_url',
    # s3_host_alias:  '<http://xxxx.cloudfront.net|xxxx.cloudfront.net>',
      # bucket:         Rails.application.credentials.dig(:aws, :bucket_name),

    styles: {
      mini:     "48x48>",
      small:    "100x100>",
      product:  "240x240>",
      large:    "600x600>"
    },

    path:          "/products/:id/:style/:basename.:extension",
    default_url:   "/products/:id/:style/:basename.:extension",
    default_style: "product",
  }
  Paperclip::Attachment.default_options.merge!(attachment_config)
end
using this config , I'm receiving an error for authorization
Copy code
Aws::S3::Errors::AccessDenied (Access Denied):
The issue is that I tried with storage.yml with the same credentials and it works but Paperclip is the only one that let me include the cloudfront url (as far as I know active storage doesn't have the cdn option) Guys please I need your help to solver this, thanks !! you are the best!! 🙏 🇨🇴
c
I think I tried from one page but not from the official rails one. I will try with this one. thanks
ok so basically after made those changes with the new helper method i have to 1. go to the product admin page and use the new cdn helper 2. using the product api endpoint , rewrite the endpoint and use the new cdn method is that correct ? Thanks