saleor: Bug: Creating an upload an image in dashboard, thumbnail url is http://localhost:8000
What are you trying to achieve?
I have saleor deployed with kubernetes. When I create a product and upload an image for that product in the dashboard, then go back to the products listing, the dashboard makes a request to http://localhost:8000/thumbnail/someImage, because that’s what the api responds with for the thumbnail url, even though the MEDIA_URL is configured, and the API_URI is configured. Not sure what I’m missing in my configuration and image build.
If I call the thumbnail endpoint myself with curl, it will generate the thumbnail and then display it, but for some reason when the image is uploaded the thumbnail url for the product is populated with localhost:8000.
Core and Dashboard version 3.8.4.
The queries below were performed against my test instance at : https://api.slr.rwx.dev/graphql/. I would be happy to supply a token to this test instance if anyone would like for debugging.
root@saleor-84c754f9c6-fqvq7:/app# env |grep localhost
# nooutput
Steps to reproduce the problem
- create a product mutation
mutation {
productCreate(input: {name: "TEST PRODUCT", category: "Q2F0ZWdvcnk6MQ==", productType: "UHJvZHVjdFR5cGU6MQ=="}) {
product {
id
name
thumbnail{url}
}
}
}
- create product media mutation
mutation {
productMediaCreate(input: {alt:"",mediaUrl:"http://ecx.images-amazon.com/images/I/415W2YHAJ4L._AA160_.jpg",product:"UHJvZHVjdDo4"}){__typename}
}
- get products query
{
products(first:1){
edges{
node{
id , slug, channel, name,
variants{
name, id
},
media{
id, url
},
thumbnail{
url
}
}
}
}
}
results
{
"data": {
"products": {
"edges": [
{
"node": {
"id": "UHJvZHVjdDo4",
"slug": "test-product",
"channel": null,
"name": "TEST PRODUCT",
"variants": [],
"media": [
{
"id": "UHJvZHVjdE1lZGlhOjY=",
"url": "https://cdn.slr.rwx.dev/media/products/415W2YHAJ4L._AA160__563c1bdb.jpg"
}
],
"thumbnail": {
"url": "http://localhost:8000/thumbnail/UHJvZHVjdE1lZGlhOjY=/256/"
}
}
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 5,
"maximumAvailable": 50000
}
}
}
What did you expect to happen?
thumbnail url should start with baseurl of api.
Logs
No response
Environment
Saleor version: 3.8.4 OS and version: Docker images built as shown in my readme
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 20 (1 by maintainers)
I think it would be nice if the shop domain was configurable via an environment variable.
The current solution still presents a problem, if Saleor is running behind a reverse proxy (Nginx) then one must enable SSL via
ENABLE_SSL=True to get thehttps://prefix in theShop.urlfield. Which doesn’t make much sense when running behind a proxy, and breaks communication to other services in the cluster. It would be enough to somehow usehttps://in the URL, without having to enable full-fledged SSL support.~Current workaround is to leave SSL off and set up a redirect in Nginx.~
Edit: ~Apparently Saleor dashboard doesn’t process multiple 301 redirects. So thumbnails will not show in dashboard.~ Edit: Chromium auto-upgrades HTTP requests to HTTPS, bypassing Nginx redirect altogether.
So the workaround for thumbnails in the dashboard is to just let Chromium auto-upgrade HTTP to HTTPS. No redirect necessary.
@magul I agree. I think the issue really is that in 3.8.4, there is no place to set this in the dashboard, so a new user like myself, doesn’t even know this setting exists. It seems to me like it should be an environment variable.
@tiendq Glad you got it sorted, yeah I don’t know anything about cloud, I only learned about this because I was developing this k8s deployment for saleor
@akhial For me it only works once per container start. Try restarting the container.
For me the domain update mutation doesn’t update the URL…
Result:
Curl command to update the site domain:
Might be There is a bug in dashboard to update store settings https://docs.saleor.io/docs/3.x/dashboard/configuration/site#general-information May be help u https://docs.saleor.io/docs/3.x/developer/api-reference/objects/shop-settings-update
https://docs.saleor.io/docs/3.x/developer/api-reference/mutations/shop-domain-update
If it helps u Please also post store settings update mutation here 😃