Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saleor does not load product images. #295

Open
feliperosenek opened this issue Oct 2, 2023 · 3 comments
Open

Saleor does not load product images. #295

feliperosenek opened this issue Oct 2, 2023 · 3 comments

Comments

@feliperosenek
Copy link

feliperosenek commented Oct 2, 2023

When installing Saleor via Docker on Ubuntu 20 it does not load product images.
The only changes made were to the docker-compose.yml file

Even making changes to the Dashboard URL, the images still have "localhost:8000".

image
image

When you click on get image link, it looks like this http://localhost:8000/thumbnail/UHJvZHVjdE1lZGlhOjM4/4096/.

image
When I open the link in the browser and replace localhost with my IP, the image loads, and when I return to Saleor, it is there.
image

Only when opening the image link on another page and changing localhost to the IP does the image load, when I go back to Saleor and reload it, the image appears.

Could it be some kind of cache error?

@bdodroid
Copy link

bdodroid commented Oct 5, 2023

Seeing the same thing.
Its got to be some kind of weird cache thing because the crazy part is, like feliperosenek said, if you open the image link in a new tab and replace the url with what it should be (so replace the localhost:8000 part), the image loads and when you go back to the product page and refresh suddenly the image works just fine and is pointing to the right url.

Super weird.

I wonder if I had the correct docker-compose.yml configuration before I even loaded it the first time, would this be an issue?

@bdodroid
Copy link

bdodroid commented Oct 6, 2023

@feliperosenek
Alright, figured it out.
Buried at the bottom of their Environment Variables docs: https://docs.saleor.io/docs/3.x/setup/configuration

Basically you just need to update the domain name via a grapqhl mutation. e.g:

mutation UpdateDomain {
  shopDomainUpdate(input: {domain: "216.238.116.173:8000"}) {
    shop {
      domain {
        host
      }
    }
  }
}

Headers

{
	"Authorization": "Bearer <token>"
}

you can get your token with this mutation using your dashoboard email and password:

mutation MyMutation2 {
  tokenCreate(email: "admin@example.com", password: "admin") {
    token
    refreshToken
    errors {
      field
      message
    }
  }
}

after I updated that and restarted the docker instance all my images are showing up and adding new ones started working

@muminoff
Copy link

This worked for me.

Enter into Django shell.

docker compose run --rm api python3 manage.py shell

Update site domain

>>> from django.contrib.sites.models import Site
>>> Site.objects.values()
<QuerySet [{'id': 1, 'domain': 'localhost:8000', 'name': 'Saleor e-commerce'}]>
>>> Site.objects.update(domain='your.ip.address:8000')
1
>>> exit()

Restart containers

docker compose down
docker compose up -d

Open in browser after clearing caches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants