Ecommerce configuration

Hello,

I am on a clean install from pipy with
tutor 10.0.10
ecommerce==10.0.2
discovery==10.0.1

Unfortunately I cannot access the ecommerce /dashboard, /courses or /admin endpoints. I created a user with admin rights as indicated in the operations section of the plugin readme (https://github.com/overhangio/tutor-ecommerce#operations)

tutor local run ecommerce ./manage.py createsuperuser

When I try to login (both via /login and /admin in the ecommerce url) I get a “Server Error” message and the following in the logs:

ecommerce_1         | 2020-07-13 07:06:20,187 ERROR 9 [ecommerce.core.models] /openedx/ecommerce/ecommerce/core/models.py:606 - Could not find lms_user_id for user 3. Called from middleware with request path: /courses/, referrer: None
ecommerce_1         | NoneType: None
ecommerce_1         | 2020-07-13 07:06:20,198 ERROR 9 [django.request] /openedx/venv/lib/python3.6/site-packages/django/utils/log.py:228 - Internal Server Error: /courses/
ecommerce_1         | Traceback (most recent call last):
ecommerce_1         |   File "/openedx/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
ecommerce_1         |     response = get_response(request)
ecommerce_1         |   File "/openedx/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 106, in _get_response
ecommerce_1         |     response = middleware_method(request, callback, callback_args, callback_kwargs)
ecommerce_1         |   File "/openedx/ecommerce/ecommerce/extensions/analytics/middleware.py", line 44, in process_view
ecommerce_1         |     user.add_lms_user_id('ecommerce_missing_lms_user_id_middleware', called_from)
ecommerce_1         |   File "/openedx/ecommerce/ecommerce/core/models.py", line 608, in add_lms_user_id
ecommerce_1         |     raise MissingLmsUserIdException(error_msg)
ecommerce_1         | ecommerce.core.exceptions.MissingLmsUserIdException: Could not find lms_user_id for user 3. Called from middleware with request path: /courses/, referrer: None

I found the following “decision” in the ecommerce repository: https://github.com/edx/ecommerce/blob/master/docs/decisions/0004-unique-identifier-for-users.rst

In the past I did manage to login by creating the user with the “createsuperuser” script, then creating the same user via the register form in the LMS and then a combination of logging in the lms and the ecommerce interfaces, however I have not been able to replicate such procedure.

I really appreciate any help you can provide.

1 Like

Currently it is possible to use the alternative solution mentioned in the link below

https://github.com/edx/ecommerce/blob/master/docs/decisions/0004-unique-identifier-for-users.rst#consequences

the allow_missing_lms_user_id waffle switch is enabled.

tutor local run ecommerce ./manage.py waffle_switch allow_missing_lms_user_id on --create

Thank you @ibrmo . I have been manually updating the ecommerce_user table so far. I am still debugging the ecommerce plugin as I faced more problems. I will report as I find solutions.

@juansele Does that mean that the createsuperuser command indicated in the tutor-ecommerce README is now invalid? If yes, what command should we use?

@regis I do not know whether there is a valid command or not.

The “new” ecommerce added a column called lms_user_id to the table ecommerce_user and it is supposed to fill it with the information it gets from the jwt the users get when they log in (in the lms using oauth2). Maybe it is something misconfigured with the authentication?

Aditionally I think there is a missing step in the ecommerce plugin documentation in order to switch from shoppingcart to e-commerce: https://edx.readthedocs.io/projects/edx-installing-configuring-and-running/en/open-release-juniper.master/ecommerce/install_ecommerce.html#switch-from-shoppingcart-to-e-commerce

Unfortunatelly I can not confirm at this point it works. I can not get to the basket page, I get an 500 server error and a Worker timeout in the logs. I have tried to debug it and read a lot of the source code with no luck. I can create a new post if you want, I want to further look into this.