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

Add product on fresh installation of Saleor

February 11, 2020 at 11:35am

Add product on fresh installation of Saleor

February 11, 2020 at 11:35am (Edited 2 months ago)
Could you guys give me a hint? I've installed Saleor, setup db, run migrations. Added category, type via dashboard. When I want to create first product I get:
ERROR saleor.graphql.errors.unhandled A query failed unexpectedly [PID:15078:Thread-7]
Traceback (most recent call last):
File "/saleor/saleor/warehouse/models.py", line 77, in get\_or\_create\_for\_country
return self.get\_variant\_stock\_for\_country(country\_code, product\_variant)
File "/saleor/saleor/warehouse/models.py", line 71, in get\_variant\_stock\_for\_country
return self.for\_country(country\_code).get(product\_variant=product\_variant)
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/django/db/models/query.py", line 406, in get
raise self.model.DoesNotExist(
saleor.warehouse.models.Stock.DoesNotExist: Stock matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/promise/promise.py", line 489, in \_resolve\_from\_executor
executor(resolve, reject)
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/promise/promise.py", line 756, in executor
return resolve(f(_args, \*\*kwargs))
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/graphql/execution/middleware.py", line 75, in make\_it\_promise
return next(_args, **kwargs)
File "/saleor/saleor/graphql/core/mutations.py", line 279, in mutate
response = cls.perform\_mutation(root, info, **data)
File "/saleor/saleor/graphql/product/mutations/products.py", line 929, in perform\_mutation
response = super().perform\_mutation(\_root, info, **data)
File "/saleor/saleor/graphql/core/mutations.py", line 451, in perform\_mutation
cls.save(info, instance, cleaned\_input)
File "/usr/lib64/python3.8/contextlib.py", line 75, in inner
return func(\*args, **kwds)
File "/saleor/saleor/graphql/product/mutations/products.py", line 915, in save
set\_stock\_quantity(variant, info.context.country, quantity)
File "/usr/lib64/python3.8/contextlib.py", line 75, in inner
return func(_args, \*\*kwds)
File "/saleor/saleor/warehouse/management.py", line 63, in set\_stock\_quantity
stock = Stock.objects.select\_for\_update(of=("self",)).get\_or\_create\_for\_country(
File "/saleor/saleor/warehouse/models.py", line 79, in get\_or\_create\_for\_country
warehouse = Warehouse.objects.for\_country(country\_code)
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/django/db/models/manager.py", line 82, in manager\_method
return getattr(self.get\_queryset(), name)(_args, \*\*kwargs)
File "/saleor/saleor/warehouse/models.py", line 19, in for\_country
return self.prefetch\_data().get(shipping\_zones**countries**contains=country)
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/django/db/models/query.py", line 406, in get
raise self.model.DoesNotExist(
saleor.warehouse.models.Warehouse.DoesNotExist: Warehouse matching query does not exist.
ERROR saleor.graphql.errors.unhandled A query failed unexpectedly [PID:15078:Thread-7]
Traceback (most recent call last):
File "/saleor/saleor/warehouse/models.py", line 77, in get\_or\_create\_for\_country
return self.get\_variant\_stock\_for\_country(country\_code, product\_variant)
File "/saleor/saleor/warehouse/models.py", line 71, in get\_variant\_stock\_for\_country
return self.for\_country(country\_code).get(product\_variant=product\_variant)
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/django/db/models/query.py", line 406, in get
raise self.model.DoesNotExist(
saleor.warehouse.models.Stock.DoesNotExist: Stock matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/promise/promise.py", line 489, in \_resolve\_from\_executor
executor(resolve, reject)
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/promise/promise.py", line 756, in executor
return resolve(f(_args, \*\*kwargs))
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/graphql/execution/middleware.py", line 75, in make\_it\_promise
return next(_args, **kwargs)
File "/saleor/saleor/graphql/core/mutations.py", line 279, in mutate
response = cls.perform\_mutation(root, info, **data)
File "/saleor/saleor/graphql/product/mutations/products.py", line 929, in perform\_mutation
response = super().perform\_mutation(\_root, info, **data)
File "/saleor/saleor/graphql/core/mutations.py", line 451, in perform\_mutation
cls.save(info, instance, cleaned\_input)
File "/usr/lib64/python3.8/contextlib.py", line 75, in inner
return func(\*args, **kwds)
File "/saleor/saleor/graphql/product/mutations/products.py", line 915, in save
set\_stock\_quantity(variant, info.context.country, quantity)
File "/usr/lib64/python3.8/contextlib.py", line 75, in inner
return func(_args, \*\*kwds)
File "/saleor/saleor/warehouse/management.py", line 63, in set\_stock\_quantity
stock = Stock.objects.select\_for\_update(of=("self",)).get\_or\_create\_for\_country(
File "/saleor/saleor/warehouse/models.py", line 79, in get\_or\_create\_for\_country
warehouse = Warehouse.objects.for\_country(country\_code)
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/django/db/models/manager.py", line 82, in manager\_method
return getattr(self.get\_queryset(), name)(_args, \*\*kwargs)
File "/saleor/saleor/warehouse/models.py", line 19, in for\_country
return self.prefetch\_data().get(shipping\_zones**countries**contains=country)
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/django/db/models/query.py", line 406, in get
raise self.model.DoesNotExist(
saleor.warehouse.models.Warehouse.DoesNotExist: Warehouse matching query does not exist.
ERROR saleor.graphql.errors.unhandled A query failed unexpectedly [PID:15078:Thread-7]
Traceback (most recent call last):
File "/saleor/saleor/warehouse/models.py", line 77, in get\_or\_create\_for\_country
return self.get\_variant\_stock\_for\_country(country\_code, product\_variant)
File "/saleor/saleor/warehouse/models.py", line 71, in get\_variant\_stock\_for\_country
return self.for\_country(country\_code).get(product\_variant=product\_variant)
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/django/db/models/query.py", line 406, in get
raise self.model.DoesNotExist(
saleor.warehouse.models.Stock.DoesNotExist: Stock matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/promise/promise.py", line 489, in \_resolve\_from\_executor
executor(resolve, reject)
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/promise/promise.py", line 756, in executor
return resolve(f(_args, \*\*kwargs))
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/graphql/execution/middleware.py", line 75, in make\_it\_promise
return next(_args, **kwargs)
File "/saleor/saleor/graphql/core/mutations.py", line 279, in mutate
response = cls.perform\_mutation(root, info, **data)
File "/saleor/saleor/graphql/product/mutations/products.py", line 929, in perform\_mutation
response = super().perform\_mutation(\_root, info, **data)
File "/saleor/saleor/graphql/core/mutations.py", line 451, in perform\_mutation
cls.save(info, instance, cleaned\_input)
File "/usr/lib64/python3.8/contextlib.py", line 75, in inner
return func(\*args, **kwds)
File "/saleor/saleor/graphql/product/mutations/products.py", line 915, in save
set\_stock\_quantity(variant, info.context.country, quantity)
File "/usr/lib64/python3.8/contextlib.py", line 75, in inner
return func(_args, \*\*kwds)
File "/saleor/saleor/warehouse/management.py", line 63, in set\_stock\_quantity
stock = Stock.objects.select\_for\_update(of=("self",)).get\_or\_create\_for\_country(
File "/saleor/saleor/warehouse/models.py", line 79, in get\_or\_create\_for\_country
warehouse = Warehouse.objects.for\_country(country\_code)
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/django/db/models/manager.py", line 82,
in manager\_method
return getattr(self.get\_queryset(), name)(_args, \*\*kwargs)
File "/saleor/saleor/warehouse/models.py", line 19, in for\_country
return self.prefetch\_data().get(shipping\_zones**countries**contains=country)
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/django/db/models/query.py", line 406, in get
raise self.model.DoesNotExist(
saleor.warehouse.models.Warehouse.DoesNotExist: Warehouse matching query does not exist.

February 11, 2020 at 12:51pm
Hey ! Are you using the master branch or Saleor 2.9.1? If the first one, then please try to install 2.9.1 and check once again.
  • reply
  • like
Hey 2.9.1 improved my situation a bit - I was able to create the product. Weee!! I see the product in the db. When I try to list them in a dashboard list page (http://localhost:9000/products/?asc=true&sort=name) nothing is showing and I'm getting 400 from api.
ERROR saleor.graphql.views Exception information: [PID:5512:Thread-3]
graphql.error.base.GraphQLError: Unknown type "CategorySortingInput". Perhaps you meant "CategoryFilterInput", "CategoryInput", "AttributeSortingInput", "SiteDomainInput" or "ShopSettingsInput"?
ERROR saleor.graphql.views Exception information: [PID:5512:Thread-3]
graphql.error.base.GraphQLError: Unknown type "CategorySortingInput". Perhaps you meant "CategoryFilterInput", "CategoryInput", "AttributeSortingInput", "SiteDomainInput" or "ShopSettingsInput"?
ERROR saleor.graphql.views Exception information: [PID:5512:Thread-3]
graphql.error.base.GraphQLError: Unknown argument "sortBy" on field "categories" of type "Query".
ERROR saleor.graphql.views Exception information: [PID:5512:Thread-3]
graphql.error.base.GraphQLError: Unknown argument "sortBy" on field "categories" of type "Query".
WARNING django.request Bad Request: /graphql/ [PID:5512:Thread-3]
WARNING django.request Bad Request: /graphql/ [PID:5512:Thread-3]
WARNING django.server "POST /graphql/ HTTP/1.1" 400 1044 [PID:5512:Thread-3]
WARNING django.server "POST /graphql/ HTTP/1.1" 400 1044 [PID:5512:Thread-3]
WARNING django.server "POST /graphql/ HTTP/1.1" 400 1044 [PID:5512:Thread-3]
INFO django.server "OPTIONS /graphql/ HTTP/1.1" 200 0 [PID:5512:Thread-3]
INFO django.server "OPTIONS /graphql/ HTTP/1.1" 200 0 [PID:5512:Thread-3]
INFO django.server "OPTIONS /graphql/ HTTP/1.1" 200 0 [PID:5512:Thread-3]
ERROR saleor.graphql.views Exception information: [PID:5512:Thread-3]
graphql.error.base.GraphQLError: Argument "filter" has invalid value {ids: $categories}.
In field "ids": Unknown field.
ERROR saleor.graphql.views Exception information: [PID:5512:Thread-3]
graphql.error.base.GraphQLError: Argument "filter" has invalid value {ids: $categories}.
In field "ids": Unknown field.
ERROR saleor.graphql.views Exception information: [PID:5512:Thread-3]
graphql.error.base.GraphQLError: Argument "filter" has invalid value {ids: $collections}.
In field "ids": Unknown field.
ERROR saleor.graphql.views Exception information: [PID:5512:Thread-3]
graphql.error.base.GraphQLError: Argument "filter" has invalid value {ids: $collections}.
In field "ids": Unknown field.
ERROR saleor.graphql.views Exception information: [PID:5512:Thread-3]
graphql.error.base.GraphQLError: Argument "filter" has invalid value {ids: $productTypes}.
In field "ids": Unknown field.
ERROR saleor.graphql.views Exception information: [PID:5512:Thread-3]
graphql.error.base.GraphQLError: Argument "filter" has invalid value {ids: $productTypes}.
In field "ids": Unknown field.
ERROR saleor.graphql.views Exception information: [PID:5512:Thread-3]
Traceback (most recent call last):
File "/home/mars/dev/schmuze/saleor/saleor/graphql/views.py", line 147, in execute_graphql_request
return document.execute(
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/graphql/backend/core.py", line 32, in execute_and_validate
return execute(schema, document_ast, *args, **kwargs)
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/graphql/execution/executor.py", line 113, in execute
exe_context = ExecutionContext(
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/graphql/execution/utils.py", line 113, in __init__
variable_values = get_variable_values(
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/graphql/execution/values.py", line 74, in get_variable_values
raise GraphQLError(
graphql.error.base.GraphQLError: Variable "$filter" got invalid value {"attributes": null, "categories": null, "collections": null, "isPublished": null, "price": null, "productTypes": null, "stockAvailability": null}.
In field "productTypes": Unknown field.
ERROR saleor.graphql.views Exception information: [PID:5512:Thread-3]
Traceback (most recent call last):
File "/home/mars/dev/schmuze/saleor/saleor/graphql/views.py", line 147, in execute_graphql_request
return document.execute(
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/graphql/backend/core.py", line 32, in execute_and_validate
return execute(schema, document_ast, *args, **kwargs)
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/graphql/execution/executor.py", line 113, in execute
exe_context = ExecutionContext(
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/graphql/execution/utils.py", line 113, in __init__
variable_values = get_variable_values(
File "/home/mars/.local/share/virtualenvs/saleor-QfSoRQei/lib/python3.8/site-packages/graphql/execution/values.py", line 74, in get_variable_values
raise GraphQLError(
graphql.error.base.GraphQLError: Variable "$filter" got invalid value {"attributes": null, "categories": null, "collections": null, "isPublished": null, "price": null, "productTypes": null, "stockAvailability": null}.
In field "productTypes": Unknown field.
WARNING django.request Bad Request: /graphql/ [PID:5512:Thread-3]
WARNING django.request Bad Request: /graphql/ [PID:5512:Thread-3]
WARNING django.server "POST /graphql/ HTTP/1.1" 400 4637 [PID:5512:Thread-3]
  • reply
  • like
I'm running v2.0.0 of the dashboard. The same goes for categories - I'm able to create them , they appear in dropdowns but I'm unable to list them on the list page.
Edited
  • reply
  • like

February 12, 2020 at 10:16am
You have to create warehouses for all shipping zones. We're working on some improvements, bu that's the only solution for now.
  • reply
  • like
I'm not sure how creating warehouses can help with ability to list the products from the dashboard. Do you mean to switch the dashboard branch to add/warehouses one and switch back to a master branch for backend ?? I'm quite confused as to what are the stable versions of these two products and on what versions shell I be for them to be compatible. So far I've tried Backend master - dashboard 2.0.0 (first error) Backend 2.3.1 - dashboard 2.0.0 (secound error) Backend 2.3.1 - dashboard add/warehouses branch ( secound error)
  • reply
  • like
please remove your current database, and then setup the database once again. https://docs.saleor.io/docs/getting-started/installation-macos/#7-prepare-the-database
  • reply
  • like
Each time I did the tests I dropped current database , created new one & run the migrations. What are the stable versions of these two products and on what versions shell I be for them to be compatible ?
  • reply
  • like
Now I'm on Backend master branch and Dashboard add/warehouses branch. Please take a look at all the other versions I've tested above. I've dropped database , recreated , run migrations. I've added warehouse , created shipping zone, made shipping zone a default. I'm still getting the first error saleor.warehouse.models.Stock.DoesNotExist followed by saleor.warehouse.models.Warehouse.DoesNotExist when I try to create the first product.
  • reply
  • like
  • reply
  • like
  • reply
  • like
  • reply
  • like

February 13, 2020 at 2:33pm
Clear your browser cache.Create new database, create new env, use Saleor stable version
Edited
  • reply
  • like
I've managed to get the basic functionality working by using the official zip packages. Basically everything I've pulled from github branches was not compatible and braking one way or the other. Thanks for your help - I appreciate your time guys.
like-fill
2
  • reply
  • like