ruby on rails - hostname "project-name.appspot.com.storage.googleapis.com" does not match the server certificate (OpenSSL::SSL::SSLError) - using fog and carriewave -
i'm trying implement image upload google cloud storage rails 4.2 app using carrierwave gem. whenever go upload image error hostname "project-name.appspot.com.storage.googleapis.com" not match server certificate (openssl::ssl::sslerror)
.
i cant see need here.
carrierwave.rb file
carrierwave.configure |config| config.fog_credentials = { provider: 'google', google_storage_access_key_id: 'key', google_storage_secret_access_key: 'secret key' } config.fog_directory = 'project-name.appspot.com' end
uploaders/check_item_value_image_uploader.rb
class checkitemvalueimageuploader < carrierwave::uploader::base # include rmagick or minimagick support: # include carrierwave::rmagick # include carrierwave::minimagick # choose kind of storage use uploader: #storage :file storage :fog # override directory uploaded files stored. # sensible default uploaders meant mounted: def store_dir "check-item-value-images/#{model.id}" end # add white list of extensions allowed uploaded. # images might use this: def extension_white_list %w(jpg jpeg gif png) end end
related gems
gem 'gcloud' gem "fog" gem 'google-api-client', '~> 0.8.6' gem "mime-types"
check_category_item_value model
mount_uploader :value, checkitemvalueimageuploader
check_category_item_value update method
if @check_category_item_value.save flash[:success] = "successfully updated" redirect_to category_items_edit_path(@guide, @category, @category_item) else render 'category_items/edit' end
edit form
<%= form_for(@check_category_item_value) |f| %> <%= f.file_field :value, :value => item_key.value, accept: "image/jpeg, image/jpg, image/gif, image/png" %> <%= f.submit "submit" %><hr> <% end %>
the forms worked fine before implemented carrierwave image upload (would save string of file name , not upload image). i've tried implement carrierwave image uploads error above.
i used carrierwave docs, this post, , this video google cloud platform have now. missing causing error?
the issue while using carrierwave have dots (.
) in bucket.
create bucket without dots , work.
Comments
Post a Comment