Saving Ecommerce Edx

Error! Failed to publish commerce data for course-v1:SolaceTech+Demo001+2019 to LMS. Incorrect authentication credentials.

I get an error when adding a course on e-commerce. What should I do?

@taufanbudiman Could you provide more details? Have you looked at the logs? What have you tried to attempt to debug this? Providing more information makes it easier to diagnose your issue.

Oh Sory, this my logs in /edx/var/ecommerce/edx.log

Feb 17 15:27:23 dev [service_variant=ecommerce][edx_rest_framework_extensions.auth.bearer.authentication] ERROR [dev 26378] [/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/edx_rest_framework_extensions/auth/bearer/authentication.py:75] - Failed to retrieve user info. Unable to authenticate.
Feb 17 15:27:40 dev [service_variant=ecommerce][edx_rest_framework_extensions.auth.bearer.authentication] ERROR [dev 26378] [/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/edx_rest_framework_extensions/auth/bearer/authentication.py:75] - Failed to retrieve user info. Unable to authenticate.
Feb 19 21:54:45 dev [service_variant=ecommerce][ecommerce.courses.models] INFO [dev 26376] [/edx/app/ecommerce/ecommerce/ecommerce/courses/models.py:205] - Retrieved course seat child product with certificate type [verified] for [course-v1:edX+DemoX+Demo_Course] from database.
Feb 19 21:54:45 dev [service_variant=ecommerce][ecommerce.courses.models] INFO [dev 26376] [/edx/app/ecommerce/ecommerce/ecommerce/courses/models.py:247] - Retrieved course seat product stock record with certificate type [verified] for [course-v1:edX+DemoX+Demo_Course] from database.
Feb 19 21:54:45 dev [service_variant=ecommerce][ecommerce.courses.models] INFO [dev 26376] [/edx/app/ecommerce/ecommerce/ecommerce/courses/models.py:205] - Retrieved course seat child product with certificate type for [course-v1:edX+DemoX+Demo_Course] from database.
Feb 19 21:54:45 dev [service_variant=ecommerce][ecommerce.courses.models] INFO [dev 26376] [/edx/app/ecommerce/ecommerce/ecommerce/courses/models.py:247] - Retrieved course seat product stock record with certificate type for [course-v1:edX+DemoX+Demo_Course] from database.
Feb 19 21:54:47 dev [service_variant=ecommerce][ecommerce.courses.publishers] ERROR [dev 26376] [/edx/app/ecommerce/ecommerce/ecommerce/courses/publishers.py:112] - Failed to publish commerce data for [course-v1:edX+DemoX+Demo_Course] to LMS. Status was [401]. Body was [{“detail”:“Incorrect authentication credentials.”}]. data : {u’verification_deadline’: ‘2020-10-24T02:53:19+00:00’, u’modes’: [{u’sku’: u’8CF08E5’, u’name’: u’verified’, u’price’: 149, u’expires’: ‘2019-10-25T02:53:00+00:00’, u’currency’: u’USD’, u’bulk_sku’: None}, {u’sku’: u’68EFFFF’, u’name’: ‘audit’, u’price’: 0, u’expires’: None, u’currency’: u’USD’, u’bulk_sku’: None}], u’id’: u’course-v1:edX+DemoX+Demo_Course’, u’name’: u’edX Demonstration Course’}, commerce : <edx_rest_api_client.client.EdxRestApiClient object at 0x7f79447a4e50>
Traceback (most recent call last):
File “/edx/app/ecommerce/ecommerce/ecommerce/courses/publishers.py”, line 103, 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)
HttpClientError: Client Error 401: https://lms.tenderhub.co/api/commerce/v1/courses/course-v1:edX+DemoX+Demo_Course/
Feb 19 21:54:47 dev [service_variant=ecommerce][ecommerce.extensions.api.serializers] ERROR [dev 26376] [/edx/app/ecommerce/ecommerce/ecommerce/extensions/api/serializers.py:498] - Failed to save and publish [course-v1:edX+DemoX+Demo_Course]: [Failed to publish commerce data for course-v1:edX+DemoX+Demo_Course to LMS. Incorrect authentication credentials.]
Traceback (most recent call last):
File “/edx/app/ecommerce/ecommerce/ecommerce/extensions/api/serializers.py”, line 495, in save
raise Exception(resp_message)
Exception: Failed to publish commerce data for course-v1:edX+DemoX+Demo_Course to LMS. Incorrect authentication credentials.

Not yet. Did you solve it?

Are you working on “localhost” or in some IP?

In that case (Using some IP) you will have to change the “localhost” values in your lms.auth.json file for your IP. Do the same in your lms.env.file and check your ecommerce.yml file too, and your devstack_docker file (just in case you see any credentials related variables or the JWT_ISSUER with incorrect values).

Then, you will have to create a credentials-client in your admin, or edit the one that open edx includes with the installation.

If you have any doubts please contact me.

I’m still a little confused, sorry.
can you explain step by step for configuration?
what must be changed. because it’s been a long time
I run on a domain not IP

Sorry for the delay:

Please, can you please try to edit a course in /courses, get the “Failed to publish commerce data for course” error and them copy your lms/edx.log last sentences?

Thanks :slight_smile:

I think is the same

Can you please copy your LMS´s log after you reproduce the issue?

sorry for delay,
i got this log
Jun 22 22:25:04 dev [service_variant=lms][gunicorn.error][env:sandbox] INFO [dev 17045] [glogging.py:213] - GET /notifier_api/v1/users/
Jun 22 22:25:32 dev [service_variant=lms][gunicorn.error][env:sandbox] INFO [dev 17045] [glogging.py:213] - POST /oauth2/access_token
Jun 22 22:25:32 dev [service_variant=lms][gunicorn.error][env:sandbox] INFO [dev 17045] [glogging.py:213] - PUT /api/commerce/v1/courses/course-v1:edX+DemoX+Demo_Course/
Jun 22 22:25:32 dev [service_variant=lms][edx_rest_framework_extensions.auth.jwt.middleware][env:sandbox] WARNING [dev 17045] [middleware.py:61] - The view CourseRetrieveUpdateView allows Jwt Authentication but needs to include the NotJwtRestrictedApplication permission class (adding it for you)
Jun 22 22:25:32 dev [service_variant=lms][edx_rest_framework_extensions.auth.jwt.decoder][env:sandbox] INFO [dev 17045] [decoder.py:173] - Token decode failed due to mismatched issuer [https://lms.tenderhub.co/oauth2]

this my lms.env.json
image
image

lms.auth.json
image

  • Can you please edit your ISSUER from 127.0.0.1 to /oauth2?

  • Also, i had some problems to edit courses from ecommerce due to the lack of info in ecommerce´s user profile, please fill some fields like name in " UserProfile object" section.

  • Does your ecommerce_worker have Super User privileges?

  • Have you configured your client at /admin/oauth2/client and added it to the “trusted clients” section?


this my config

I have replaced ISSUER from 127.0.0.1 to /oauth2 and restart lms
display log like this
31968] [glogging.py:213] - PUT /api/commerce/v1/courses/course-v1:edX+DemoX+Demo_Course/
Jun 30 11:51:29 dev [service_variant=lms][edx_rest_framework_extensions.auth.jwt.decoder][env:sandbox] INFO [dev 31968] [decoder.py:173] - Token decode failed due to mismatched issuer [https://lms.tenderhub.co/oauth2]

where i found UserProfile Object? in user django admin?

Hi @taufanbudiman:

The UserProfile Object is a section in the users detailed page, jut go to your LMS Django admin and clic on “users” then, clic on your Ecommerce user and fill the UserProfile Object.

Tell me if this solves your problem, if not, we will keep trying.

Captura de Pantalla 2020-07-02 a la(s) 8.10.59