Hello, i’m testing production and i need to face a...
# support
w
Hello, i’m testing production and i need to face a problem with product images attachments hosted on a S3, i mean that the url are not permanent. after some search i thought that setting active storage on proxy mode (:rails_storage_proxy) would be enough, but this does not seems to work, i’ve always the same url to s3 bucket. has anyone experience with that? maybe i could change directly the render code of image obtaining url with something like rails_representation_url(image, only_path: true), but this should be done out of the box, and i do not understand exactly why does not work, maybe the problem is the engine behaviour? Thanks
w
Are you experiencing that on the list of products or in an individual product page?
I’d say that’s probably a caching issue. You can try disabling cache on production to test if that’s the issue.
w
i know that problem is linked to cache, and this because of expiring url. my question is about configuring Solidus to use active storage proxy, the other option could be public storage but i would prefer the first.
i found this issue on spree : Active Storage Uses Expiring Representations For Product Image URLs #8984 solved by spree 4.2 what about solidus?
w
I’m not sure I follow, but you can still configure ActiveStorage through
config/storage.yml
. If you need to override something, your target will probably be https://github.com/solidusio/solidus/blob/bf0803d42ee3a07cea6272446869fe15730ffaef/core/app/models/concerns/spree/active_storage_adapter.rb#L108
w
thanks, i was watching exactly inside that module, but before mess around the code, because of my lack of knowledge, i was asking how other people solved this obvious problem. After all an S3 bucket as ActiveStorage service is quite common, out of the box this in production does not work, because url get cached and after url expire time the product images are no more visible.
m
@Wladjmir I’m facing this exact same issue : images attachments hosted on a S3 bucket become unaccessible after a while. Have you found a solution?
w
Hi Manu, at the end i configured app for public storage.
Copy code
digitalocean:
  service: …
  endpoint: <https://ams3.digitaloceanspaces.com/>
  access_key_id: <%= Rails.application.credentials.dig(:digitalocean, :access_key) %>
  secret_access_key: <%= Rails.application.credentials.dig(:digitalocean, :secret) %>
  bucket: …
  public: true
  region: unused
m
Thanks!