Failed to publish commerce data for course to LMS

539 views
Skip to first unread message

Mark Davies Tan

unread,
Jun 27, 2018, 11:44:54 PM6/27/18
to General Open edX discussion
Hi all,

I recently got the ecommerce setup and I tried changing a course to paid just to test things out but when I tried to save it gave me this error
Failed to publish commerce data for course-v1:Ministry+MLDCNTDYMT+2018_Q3 to LMS.

Does it have anything to do with the COURSE_CATALOG_API_URL in /edx/etc/ecommerce.yml? Or does it have something to do with discovery_api_url when I run the create_or_update_site?

Thanks.

Trinh Nguyen

unread,
Jun 27, 2018, 11:47:10 PM6/27/18
to edx-...@googlegroups.com
Hi,

It's nothing to do with e-commerce publish data to LMS. It just means that there's something wrong with the communication pipe between the two.

What do the logs say?



Trinh Nguyen | Founder





--
You received this message because you are subscribed to the Google Groups "General Open edX discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/95169020-f81a-4049-acc8-a7151373e168%40googlegroups.com.

Mark Davies Tan

unread,
Jun 27, 2018, 11:54:05 PM6/27/18
to General Open edX discussion
Hi Trinh,

I checked the ecommerce log and saw this:

  • Course seat product with certificate type [] for [course-v1:Ministry+MLDCNTDYMT+2018_Q3] does not exist. Instantiated a new instance.
  • Course seat product stock record with certificate type [] for [course-v1:Ministry+MLDCNTDYMT+2018_Q3] does not exist. Instantiated a new instance.
  • Course seat product with certificate type [verified] for [course-v1:Ministry+MLDCNTDYMT+2018_Q3] does not exist. Instantiated a new instance.
  • Failed to retrieve course catalogs data from the Discovery Service API.
  • Internal Server Error: /api/v2/enterprise/customers
  • Failed to publish commerce data for [course-v1:Ministry+MLDCNTDYMT+2018_Q3] to LMS.
  • Failed to save and publish [course-v1:Ministry+MLDCNTDYMT+2018_Q3]: [Failed to publish commerce data for course-v1:Ministry+MLDCNTDYMT+2018_Q3 to LMS.]
Also I noticed when I ran supervisorclt status that I dont have ecomworker. Is it because of that?

Trinh Nguyen

unread,
Jun 28, 2018, 12:08:13 AM6/28/18
to edx-...@googlegroups.com
Must be some misconfiguration of enterprise customer or something because " Internal Server Error: /api/v2/enterprise/customers"

"Failed to retrieve course catalogs data from the Discovery Service API." => this is just used for querying some course info in ecommerce checkout page.

I'm running e-commerce without worker and can create the course in e-commerce.





Trinh Nguyen | Founder




Mark Davies Tan

unread,
Jun 28, 2018, 12:12:20 AM6/28/18
to General Open edX discussion
Ok, that's good to know about the ecomworker not being required. 
So it's also not the discovery service api then. 
I checked the lms logs and saw this 
  • Internal Server Error: /oauth2/access_token
  • ValueError: Cannot assign None: "AccessToken.user" does not allow null values.

Trinh Nguyen

unread,
Jun 28, 2018, 12:17:47 AM6/28/18
to edx-...@googlegroups.com
Ok, you need to attach a staff user to your e-commerce oauth2 client even though the documentation says to leave that field blank.


Trinh Nguyen | Founder




Mark Davies Tan

unread,
Jun 28, 2018, 12:27:35 AM6/28/18
to General Open edX discussion
Ok, set a staff user to the oauth2 client. 
Gave it another try and now I got this 
Error! Failed to publish commerce data for course-v1:Ministry+MLDCNTDYMT+2018_Q3 to LMS. Authentication credentials were not provided.

Trinh Nguyen

unread,
Jun 28, 2018, 1:09:11 AM6/28/18
to edx-...@googlegroups.com
I encountered this issue before. If you run the Microsoft folk of Open edX, you need to folk e-commerce around the same time of your Open edX branch.



Trinh Nguyen | Founder




Mark Davies Tan

unread,
Jun 28, 2018, 3:44:01 AM6/28/18
to General Open edX discussion
Hmm, I actually ran the ecommerce that was in the configuration fork of MS's open edx the same time we got the fork of MS open edx so I think the fork should be fine?

Trinh Nguyen

unread,
Jun 28, 2018, 3:59:46 AM6/28/18
to edx-...@googlegroups.com
I'm not sure. Do you have any more logs?


Trinh Nguyen | Founder




Mark Davies Tan

unread,
Jun 28, 2018, 4:07:07 AM6/28/18
to General Open edX discussion
so far I tried a different course so for ecommerce log:
  • Not Found: /api/v2/courses/course-v1:Education+DAT203.1x+2018_T1/
  • Not Found: /api/commerce/v1/courses/course-v1:Education+DAT203.1x+2018_T1/

Trinh Nguyen

unread,
Jun 28, 2018, 4:09:23 AM6/28/18
to edx-...@googlegroups.com
The correct course ID is: course-v1:Education+DAT203.1x+2018_T1



Trinh Nguyen | Founder




Mark Davies Tan

unread,
Jun 28, 2018, 4:24:18 AM6/28/18
to General Open edX discussion
Yeah that's what I tried

Trinh Nguyen

unread,
Jun 28, 2018, 4:27:10 AM6/28/18
to edx-...@googlegroups.com
I don't understand where did you try that? Did you mean you can enter the E-commerce Course Administrator page? At which step you got that error? Please help me to understand.




Trinh Nguyen | Founder




Mark Davies Tan

unread,
Jun 28, 2018, 4:42:08 AM6/28/18
to General Open edX discussion
Yes i can enter the Ecommerce Course Administration page and there I click Add New Course, place the course ID and course name there and chose Free as course type with no honor seat.
I didnt change any ecommerce related things in cms.env.json so I noticed that the ECOMMERCE_API_URL and ECOMMERCE_PUBLIC_URL_ROOT are still set to the default which was http://localhost:8002/api/v2 and http://localhost:8002 respectively.
Do I need to change them for cms.env.json?

Trinh Nguyen

unread,
Jun 28, 2018, 8:12:31 AM6/28/18
to edx-...@googlegroups.com
Try that.


Trinh Nguyen | Founder




Mark Davies Tan

unread,
Jun 29, 2018, 12:23:09 AM6/29/18
to General Open edX discussion
Tried changing ECOMMERCE_API_URL and ECOMMERCE_PUBLIC_URL_ROOT in cms.env.json and still the same issue. 

Trinh Nguyen

unread,
Jun 29, 2018, 12:29:09 AM6/29/18
to edx-...@googlegroups.com
Did you check all of the key and credentials especially EDX_API_KEY in lms.auth.json and ecommerce.yml should be the same?



Trinh Nguyen | Founder




Mark Davies Tan

unread,
Jun 29, 2018, 2:07:20 AM6/29/18
to General Open edX discussion
Been double checking them and they all seem to be right.
Like I didnt change EDX_API_KEY so it's still the default PUT_YOUR_API_KEY_HERE but it's also the same on the other file.
Just a thought, what I did to be able to access the ecommerce side is to use the IP of the traffic manager/load balancer from azure, so something like IP address:18130. 
However my lms url is let's say https://myurl.com. I wasnt able to allow access to myurl.com:18130 coz azure's vmss doesnt support NAT rules at the moment it seems.
Do you think using IP:18130 is causing the problem? I can login to the admin side of ecommerce though.

Trinh Nguyen

unread,
Jun 29, 2018, 9:32:34 AM6/29/18
to edx-...@googlegroups.com
So, try to use a sub domain for your e-commerce, something like https://ecom.myurl.com (need to configure nginx to run ecommerce at port 443)


Trinh Nguyen | Founder




Mark Davies Tan

unread,
Jul 2, 2018, 2:54:55 AM7/2/18
to General Open edX discussion
So I tried giving my ecommerce a subdomain and it's still giving me the authentication credentials were not provided error.
Let's say my LMS url is https://lms-master.company.com, the ecommerce url is https://ecom-lms.company.com. Nothing wrong with that right?

Trinh Nguyen

unread,
Jul 2, 2018, 3:29:00 AM7/2/18
to edx-...@googlegroups.com
Can you give me all the logs and your configuration file?



Trinh Nguyen | Founder




Mark Davies Tan

unread,
Jul 3, 2018, 12:25:00 AM7/3/18
to General Open edX discussion
Hmm I'm wondering if all the courses being in child sites have anything to do with the issue? 

Mark Davies Tan

unread,
Jul 3, 2018, 2:22:37 AM7/3/18
to General Open edX discussion
I tried creating 2 courses in the Course Administration Tool.
Ecommerce log:

Jul  2 21:10:55 EPTECLAASvmss000000 [service_variant=ecommerce][ecommerce.courses.publishers] ERROR [EPTECLAASvmss000000  50415] [/edx/app/ecommerce/ecommerce/ecommerce/courses/publishers.py:112] - Failed to publish commerce data for [course-v1:Business+BLDENLDGLD+2018_Q3] to LMS.
Traceback (most recent call last):
  File "/edx/app/ecommerce/ecommerce/ecommerce/courses/publishers.py", line 101, in publish
    commerce_api_client.courses(course_id).put(data=data)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/slumber/__init__.py", line 175, in put
    resp = self._request("PUT", data=data, files=files, params=kwargs)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/slumber/__init__.py", line 97, in _request
    resp = self._store["session"].request(method, url, data=data, params=params, files=files, headers=headers)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/requests/sessions.py", line 502, in request
    resp = self.send(prep, **send_kwargs)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/requests/sessions.py", line 612, in send
    r = adapter.send(request, **kwargs)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/requests/adapters.py", line 490, in send
    raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error("(110, 'ETIMEDOUT')",))
Jul  2 21:10:55 EPTECLAASvmss000000 [service_variant=ecommerce][ecommerce.extensions.api.serializers] ERROR [EPTECLAASvmss000000  50415] [/edx/app/ecommerce/ecommerce/ecommerce/extensions/api/serializers.py:497] - Failed to save and publish [course-v1:Business+BLDENLDGLD+2018_Q3]: [Failed to publish commerce data for course-v1:Business+BLDENLDGLD+2018_Q3 to LMS.]
Traceback (most recent call last):
  File "/edx/app/ecommerce/ecommerce/ecommerce/extensions/api/serializers.py", line 494, in save
    raise Exception(resp_message)
Exception: Failed to publish commerce data for course-v1:Business+BLDENLDGLD+2018_Q3 to LMS.
Jul  2 21:55:21 EPTECLAASvmss000000 [service_variant=ecommerce][ecommerce.courses.publishers] ERROR [EPTECLAASvmss000000  50416] [/edx/app/ecommerce/ecommerce/ecommerce/courses/publishers.py:108] - Failed to publish commerce data for [course-v1:Ministry+MLDCNTDYMT+2018_Q3] to LMS. Status was [401]. Body was [{"detail":"Authentication credentials were not provided."}].
Traceback (most recent call last):
  File "/edx/app/ecommerce/ecommerce/ecommerce/courses/publishers.py", line 101, in publish
    commerce_api_client.courses(course_id).put(data=data)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/slumber/__init__.py", line 175, in put
    resp = self._request("PUT", data=data, files=files, params=kwargs)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/slumber/__init__.py", line 101, in _request
    raise exception_class("Client Error %s: %s" % (resp.status_code, url), response=resp, content=resp.content)
Jul  2 21:55:21 EPTECLAASvmss000000 [service_variant=ecommerce][ecommerce.extensions.api.serializers] ERROR [EPTECLAASvmss000000  50416] [/edx/app/ecommerce/ecommerce/ecommerce/extensions/api/serializers.py:497] - Failed to save and publish [course-v1:Ministry+MLDCNTDYMT+2018_Q3]: [Failed to publish commerce data for course-v1:Ministry+MLDCNTDYMT+2018_Q3 to LMS. Authentication credentials were not provided.]
Traceback (most recent call last):
  File "/edx/app/ecommerce/ecommerce/ecommerce/extensions/api/serializers.py", line 494, in save
    raise Exception(resp_message)
Exception: Failed to publish commerce data for course-v1:Ministry+MLDCNTDYMT+2018_Q3 to LMS. Authentication credentials were not provided.

Mark Davies Tan

unread,
Jul 3, 2018, 3:40:55 AM7/3/18
to General Open edX discussion
I also checked the last commits of the openedx and ecommerce that i'm using.
Seems to be the openedx is around Nov 30 2017 meanwhile the ecommerce is from June 14, 2016.
Reply all
Reply to author
Forward
0 new messages