menu

Saleor Commerce

The world’s fastest growing open-source e-commerce platform with billions of dollars transacted. Powered by Python, GraphQL, ReactJS and PWA.

Channels
# All channels
view-forward
# General
view-forward
# Announcements
view-forward
# Design
view-forward
# Development
view-forward
# Saleor Features
view-forward
Team

Images not showing up after moving media to Amazon S3

February 5, 2020 at 3:52am

Images not showing up after moving media to Amazon S3

February 5, 2020 at 3:52am
DEBUG:True AWS_ACCESS_KEY_ID = "aws-access-key-id" AWS_MEDIA_BUCKET_NAME = "name-of-the-bucket" AWS_QUERYSTRING_AUTH = False AWS_S3_REGION_NAME = "us-west-1" AWS_SECRET_ACCESS_KEY ="secret-access-key" AWS_DEFAULT_ACL =None
S3_URL = '//%s.s3.amazonaws.com/' % AWS_MEDIA_BUCKET_NAME MEDIA_URL = S3_URL + 'media/' MEDIA_ROOT = MEDIA_URL

February 5, 2020 at 10:46am
Hey ! It seems you have set incorrect file permissions on S3. They are set as private by default because we don't know which file the user would like to publish. You can find more info here: https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html
Edited
  • reply
  • like
AWS_DEFAULT_ACL (optional, None or canned ACL, default public-read) Must be either None or from the list of canned ACLs. If set to None then all files will inherit the bucket’s ACL.
  • reply
  • like
How to set correct file permissions.
  • reply
  • like
I have set public bucket and AWS_DEFAULT_ACL =None. Image seems to be added to bucket, but can't view it on my app.
  • reply
  • like

February 5, 2020 at 8:59pm
solved. Thank you
  • reply
  • like

February 6, 2020 at 9:23am
Awesome!
  • reply
  • like

February 10, 2020 at 2:34am
Hey I am facing the same issue but I moved to Google Cloud.
  • reply
  • like
I set this on common.env
GOOGLE_APPLICATION_CREDENTIALS=/path/to/file GS_MEDIA_BUCKET_NAME=bucket-name
But after doing that all of my previous images are not visible, is there a way to migrate all my images to this new bucket?
web_1 | OSError: File does not exist: products/DSC_0012_clipped_rev_3.jpeg
web_1 | /usr/local/lib/python3.8/site-packages/django/core/cache/backends/base.py:246: CacheKeyWarning: Cache key will cause errors if used with memcached: ':1:https://storage.googleapis.com/ponti-rack-ecommerce-images-staging/__sized__/products/DSC_0022_clipped_rev_3-thumbnail-255x255.png?Expires=1581387466&GoogleAccessId=ponti-rack-ecommerce-storage-s%40ponti-rack-ecommerce.iam.gserviceaccount.com&Signature=e%2FL8ooW9Ew6iy%2Fw0FM%2FQkrhKHJTvbV0xjV8AmL5PAtjwNObhBzUcAtghe0EkSAF3KiF5VK6j013rhKKCB%2B8aC4ywJjCNDNbCEo1AAFAAXJ2rC7xE7xyXvwRX3Fo9ZbzJhCs6RlYucFW9u1qytVQ3AVRwdixyb%2BzNZ2%2F7B1lteZFPEs7r%2BPQUSnNTHa1zPeLa21Pk8eM6T2%2BnOL2xf47KytnqVHQCJ4odVnpFjFTSS9POKx%2BxtxYQDOx1KF7MMjiMEP7fkbjNkAGLmG7RGHguZpm4Hal5qHTecoXYQmSK7L9PJO4Aq62eum68aFO45udK6GtomCH1SxVx8Rcbsr58og%3D%3D' (longer than 250)
web_1 | warnings.warn(
web_1 | /usr/local/lib/python3.8/site-packages/django/core/cache/backends/base.py:246: CacheKeyWarning: Cache key will cause errors if used with memcached: ':1:https://storage.googleapis.com/ponti-rack-ecommerce-images-staging/__sized__/products/DSC_0022_clipped_rev_3-thumbnail-510x510.png?Expires=1581387466&GoogleAccessId=ponti-rack-ecommerce-storage-s%40ponti-rack-ecommerce.iam.gserviceaccount.com&Signature=Puw6nGdx7ic3NNS5AvnypXf2MNcJOwWjDMAQ%2F9KgWgLsfn49te5T7uegV0HcdBmmUpicuGz0WUv1imY7Sf7H8sgrniYxiCWUa7RK1RibNzn0aptpwBN3sgd2CRVqn3OrSOxfUnvrqMuhAvmi9jDX8wRifbhS6yVwhdH0x0VJShLOUefOP52kJg8u%2B67P%2FfwlPW4nOYbh8HoOrcwkwYd3hQXyJQSTclJpcu94fdyWTCTNzt8Z2nxn8s19I9pb9j714%2F20PGmmu42YSck%2FKeSbNMCC5G9ku0B0NReuF7nWAmhb%2Fut3kt%2ByJin8Qhwf6Y6OWarg5cEOo4NY8brg5yE6zQ%3D%3D' (longer than 250)
web_1 | warnings.warn(
  • reply
  • like
Anything you can think of as a solution? Also I'm having an issue when uploading product images to a new product this is what the error message looks like
celery_1 | 'File {} was not found.'.format(filename))
celery_1 | google.auth.exceptions.DefaultCredentialsError: File /path/to/credentials.json was not found.
celery_1 |
celery_1 | ERROR saleor.core.utils Failed to generate thumbnails [PID:11:MainThread]
celery_1 | [2020-02-09 21:38:35,150: ERROR/ForkPoolWorker-2] Failed to generate thumbnails
celery_1 | [2020-02-09 21:38:35,152: INFO/ForkPoolWorker-2] Task saleor.product.thumbnails.create_product_thumbnails[610991c6-d743-4aa1-985e-30e667604ca1] succeeded in 0.47085470001911744s: None
What is strange to me is that it was able to find the file path because I see the images in the bucket. The path that I'm passing is an absolute path, and I'm running the application on Docker Compose.
  • reply
  • like

February 10, 2020 at 10:18am
Hey . Let me take a look at it. I'll get back to you later today.
  • reply
  • like

February 11, 2020 at 2:06pm
Thanks very appreciated!
  • reply
  • like
Hey! Did you follow the instructions from our docs? https://docs.saleor.io/docs/deployment/gcs/#docsNav
Edited
  • reply
  • like
  • reply
  • like