Hi,
I just deployed and configured the eCommerce application using the following guides:
How to Install and Start the E-Commerce Service in Native Installations
Open edX Ecommerce
Everything seems to work properly but when I try to create a new Course in the eCommerce platform, using this guide (https://readthedocs.org/projects/edx-ecommerce/downloads/pdf/latest/) I get the following error:
Failed to publish commerce data for course-v1:csX+CS101x+2020_T1 to LMS
I reviewed the eCommerce log in /edx/var/logs/ecommerce/edx.log and I didnât find anything meaningful to me. Here is a portion of the log:
Exception: Failed to publish commerce data for course-v1:csX+CS101x+2020_T1 to LMS.
Mar 3 20:05:45 PROD-OpenEDX-VM01 [service_variant=ecommerce][django.request] WARNING [PROD-OpenEDX-VM01 25161] [/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/core/handlers/base.py:152] - Not Found: /api/v2/courses/course-v1:csX+CS101x+2020_T1/
Mar 3 20:05:45 PROD-OpenEDX-VM01 [service_variant=ecommerce][django.request] WARNING [PROD-OpenEDX-VM01 25161] [/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/core/handlers/base.py:152] - Not Found: /api/v2/courses/course-v1:csX+CS101x+2020_T1/
Mar 3 20:05:45 PROD-OpenEDX-VM01 [service_variant=ecommerce][django.request] WARNING [PROD-OpenEDX-VM01 25161] [/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/core/handlers/base.py:152] - Not Found: /api/v2/courses/course-v1:csX+CS101x+2020_T1/
Mar 3 20:07:24 PROD-OpenEDX-VM01 [service_variant=ecommerce][django.request] WARNING [PROD-OpenEDX-VM01 25160] [/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/core/handlers/base.py:152] - Not Found: /api/v2/courses/course-v1:csX+CS101x+2020_T1/
Mar 3 20:07:24 PROD-OpenEDX-VM01 [service_variant=ecommerce][django.request] WARNING [PROD-OpenEDX-VM01 25160] [/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/core/handlers/base.py:152] - Not Found: /api/v2/courses/course-v1:csX+CS101x+2020_T1/
Mar 3 20:07:24 PROD-OpenEDX-VM01 [service_variant=ecommerce][django.request] WARNING [PROD-OpenEDX-VM01 25160] [/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/core/handlers/base.py:152] - Not Found: /api/v2/courses/course-v1:csX+CS101x+2020_T1/
Mar 3 20:07:25 PROD-OpenEDX-VM01 [service_variant=ecommerce][ecommerce.courses.models] INFO [PROD-OpenEDX-VM01 25160] [/edx/app/ecommerce/ecommerce/ecommerce/courses/models.py:212] - Course seat product with certificate type [honor] for [course-v1:csX+CS101x+2020_T1] does not exist. Instantiated a new instance.
Mar 3 20:07:25 PROD-OpenEDX-VM01 [service_variant=ecommerce][ecommerce.courses.models] INFO [PROD-OpenEDX-VM01 25160] [/edx/app/ecommerce/ecommerce/ecommerce/courses/models.py:256] - Course seat product stock record with certificate type [honor] for [course-v1:csX+CS101x+2020_T1] does not exist. Instantiated a new instance.
Mar 3 20:07:25 PROD-OpenEDX-VM01 [service_variant=ecommerce][ecommerce.courses.models] INFO [PROD-OpenEDX-VM01 25160] [/edx/app/ecommerce/ecommerce/ecommerce/courses/models.py:205] - Retrieved course seat child product with certificate type [honor] for [course-v1:csX+CS101x+2020_T1] from database.
Mar 3 20:07:25 PROD-OpenEDX-VM01 [service_variant=ecommerce][ecommerce.courses.models] INFO [PROD-OpenEDX-VM01 25160] [/edx/app/ecommerce/ecommerce/ecommerce/courses/models.py:247] - Retrieved course seat product stock record with certificate type [honor] for [course-v1:csX+CS101x+2020_T1] from database.
Mar 3 20:07:25 PROD-OpenEDX-VM01 [service_variant=ecommerce][ecommerce.courses.publishers] ERROR [PROD-OpenEDX-VM01 25160] [/edx/app/ecommerce/ecommerce/ecommerce/courses/publishers.py:112] - Failed to publish commerce data for [course-v1:csX+CS101x+2020_T1] to LMS.
Traceback (most recent call last):
File â/edx/app/ecommerce/ecommerce/ecommerce/courses/publishers.pyâ, line 100, in publish
commerce_api_client = site.siteconfiguration.commerce_api_client
File â/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/utils/functional.pyâ, line 35, in get
res = instance.dict[self.name] = self.func(instance)
File â/edx/app/ecommerce/ecommerce/ecommerce/core/models.pyâ, line 457, in commerce_api_client
return EdxRestApiClient(self.build_lms_url(â/api/commerce/v1/â), jwt=self.access_token)
File â/edx/app/ecommerce/ecommerce/ecommerce/core/models.pyâ, line 384, in access_token
token_type=âjwtâ
File â/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/edx_rest_api_client/client.pyâ, line 142, in get_oauth_access_token
return get_oauth_access_token(url, client_id, client_secret, token_type=token_type)
File â/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/edx_rest_api_client/client.pyâ, line 76, in get_oauth_access_token
data = response.json()
File â/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/requests/models.pyâ, line 897, in json
return complexjson.loads(self.text, **kwargs)
File â/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/simplejson/init.pyâ, line 518, in loads
return _default_decoder.decode(s)
File â/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/simplejson/decoder.pyâ, line 370, in decode
obj, end = self.raw_decode(s)
File â/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/simplejson/decoder.pyâ, line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
JSONDecodeError: Expecting value: line 9 column 1 (char 8)
Mar 3 20:07:25 PROD-OpenEDX-VM01 [service_variant=ecommerce][ecommerce.extensions.api.serializers] ERROR [PROD-OpenEDX-VM01 25160] [/edx/app/ecommerce/ecommerce/ecommerce/extensions/api/serializers.py:585] - Failed to save and publish [course-v1:csX+CS101x+2020_T1]: [Failed to publish commerce data for course-v1:csX+CS101x+2020_T1 to LMS.]
Traceback (most recent call last):
File â/edx/app/ecommerce/ecommerce/ecommerce/extensions/api/serializers.pyâ, line 582, in save
raise Exception(resp_message)
Exception: Failed to publish commerce data for course-v1:csX+CS101x+2020_T1 to LMS.
If I try to access directly to https://ecommerce.cs.org/api/v2/courses/course-v1:csX+CS101x+2020_T1/ I get a âNot found errorâ so I think that the course is never created before to publish to the LMS. The course already exists in the LMS. I get the same result if I try the same process with a new course that does not exist on the LMS.
Any idea about what could be happening here?
Thanks in advance!!