ecommerce basket issue

419 views
Skip to first unread message

Alden Jones

unread,
Jan 14, 2017, 10:25:03 PM1/14/17
to Open edX operations
I have ecommerce running on a Eucalyptus Fullstack installation. I followed all the installation and configurations docs I could find and I'm able to access the CAT as well as the Oscar Dashboard and add classes. I'm having trouble adding courses to the basket though, when I try to enroll in a course I get a JSON error:

JSONDecodeError at /basket/

Expecting value: line 9 column 1 (char 8)

Request Method: GET
Django Version: 1.8.16
Exception Type: JSONDecodeError
Exception Value:

Expecting value: line 9 column 1 (char 8)

Exception Location: /edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/simplejson/decoder.py in raw_decode, line 404
Python Executable: /edx/app/ecommerce/venvs/ecommerce/bin/python
Python Version: 2.7.10
Python Path:

['/edx/app/ecommerce/ecommerce',
 '/edx/app/ecommerce/ecommerce',
 '/edx/app/ecommerce/venvs/ecommerce/bin',
 '/edx/app/ecommerce/venvs/ecommerce/lib/python2.7',
 '/edx/app/ecommerce/venvs/ecommerce/lib/python2.7/plat-linux2',
 '/edx/app/ecommerce/venvs/ecommerce/lib/python2.7/lib-tk',
 '/edx/app/ecommerce/venvs/ecommerce/lib/python2.7/lib-old',
 '/edx/app/ecommerce/venvs/ecommerce/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages',
 '/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/newrelic-2.74.0.54',
 '/edx/app/ecommerce/venvs/ecommerce/lib/python2.7/site-packages',
 '/edx/app/ecommerce/venvs/ecommerce/lib/python2.7/site-packages/newrelic-2.74.0.54',
 '/edx/app/ecommerce/ecommerce',
 '/edx/app/ecommerce/ecommerce/ecommerce',
 '/edx/app/ecommerce/ecommerce']


Things are, to the best of my knowledge, all set in the lms.env.json, lms.auth.json, and ecommerce.yml files... Is there another place I have to set flags? I'm able to directly access /receipt/ and /checkout/ there just seems to be an issue accessing the basket.

Thanks!

Alden Jones

Clinton Blackburn

unread,
Jan 15, 2017, 2:26:37 PM1/15/17
to Open edX operations
Alden,

Can you share more information—specifically, a stack trace. Based on what you have provided, it is unclear why your installation is having issues.

Clinton

Adithya Soman

unread,
Jan 16, 2017, 6:54:06 AM1/16/17
to Open edX operations
Hi Alden,

I believe you have installed master version of ecommerce, Try installing open-release/eucalytptus.1 or open-release/eucalytptus.2 

replace ECOMMERCE_VERSION and  ECOMMERCE_WORKER_VERSION:  variable with the version which you want to install.


Thanks
Adithya Soman

Alden Jones

unread,
Jan 18, 2017, 3:27:49 PM1/18/17
to Open edX operations
Thanks for attempting to help... I pulled lms and ecommerce logs from today 

This is the latest entry in the lms log:

Jan 18 12:13:21 ubuntu [service_variant=lms][django.request][env:sandbox] ERROR [ubuntu  10483] [base.py:256] - Internal Server Error: /oauth2/access_t$
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 145, in inner
    return func(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/oauth_dispatch/views.py", line 87, in dispatch
    response = super(AccessTokenView, self).dispatch(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/oauth_dispatch/views.py", line 46, in dispatch
    return view(request, *args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/provider/views.py", line 136, in dispatch
    response = super(OAuthView, self).dispatch(request, *args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/generic/base.py", line 89, in dispatch
    return handler(request, *args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/provider/views.py", line 715, in post
    return handler(request, request.POST, client)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/provider/views.py", line 659, in client_credentials
    at, rt = self.get_access_and_refresh_tokens(**kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/provider/views.py", line 119, in get_access_and_refresh_tokens
    at = self.create_access_token(request, user, scope, client)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/provider/oauth2/views.py", line 33, in create_access_token
    scope=scope
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/query.py", line 346, in create
    obj = self.model(**kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/base.py", line 468, in __init__
    setattr(self, field.name, rel_obj)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/fields/related.py", line 631, in __set__
    (instance._meta.object_name, self.field.name)
ValueError: Cannot assign None: "AccessToken.user" does not allow null values.

Alden Jones

unread,
Jan 18, 2017, 3:28:12 PM1/18/17
to Open edX operations
And this is the log entry from the ecommerce log:

Traceback (most recent call last):
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/utils/decorators.py", line 145, in inner
    return func(*args, **kwargs)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/views/generic/base.py", line 89, in dispatch
    return handler(request, *args, **kwargs)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/extra_views/formsets.py", line 338, in get
    return super(BaseModelFormSetView, self).get(request, *args, **kwargs)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/extra_views/formsets.py", line 301, in get
    return self.render_to_response(self.get_context_data(formset=formset))
  File "/edx/app/ecommerce/ecommerce/ecommerce/extensions/basket/views.py", line 147, in get_context_data
    line_data = self._get_course_data(line.product)
  File "/edx/app/ecommerce/ecommerce/ecommerce/extensions/basket/views.py", line 115, in _get_course_data
    course = get_course_info_from_catalog(self.request.site, course_key)
  File "/edx/app/ecommerce/ecommerce/ecommerce/courses/utils.py", line 25, in get_course_info_from_catalog
    api = site.siteconfiguration.course_catalog_api_client
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/utils/functional.py", line 59, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/edx/app/ecommerce/ecommerce/ecommerce/core/models.py", line 330, in course_catalog_api_client
    return EdxRestApiClient(settings.COURSE_CATALOG_API_URL, jwt=self.access_token)
  File "/edx/app/ecommerce/ecommerce/ecommerce/core/models.py", line 313, 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 36, in get_oauth_access_token
    data = response.json()
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/requests/models.py", line 808, in json
    return complexjson.loads(self.text, **kwargs)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/simplejson/__init__.py", line 516, in loads
    return _default_decoder.decode(s)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/simplejson/decoder.py", line 374, in decode
    obj, end = self.raw_decode(s)
  File "/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/simplejson/decoder.py", line 404, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
JSONDecodeError: Expecting value: line 9 column 1 (char 8)

Clinton Blackburn

unread,
Jan 19, 2017, 9:11:40 AM1/19/17
to Open edX operations
ValueError: Cannot assign None: "AccessToken.user" does not allow null values.

Make sure you have a user associated with your OAuth 2 client. We usually use a service user (e.g. ecommerce_user) with staff permissions for this purpose. When you make server-to-server calls using the client credentials authentication method, this is the user for whom an access token will be issued.

Clinton 

Alden Jones

unread,
Jan 19, 2017, 1:56:38 PM1/19/17
to Open edX operations
Thanks Clinton, that worked like a charm!

Message has been deleted

Trinh Nguyen

unread,
Jun 7, 2017, 6:33:35 AM6/7/17
to Open edX operations
Thanks Clinton, this works:

"Make sure you have a user associated with your OAuth 2 client..."

Ganesh Kumar

unread,
Sep 20, 2017, 8:02:51 AM9/20/17
to Open edX operations
thanks Clinton... it saved my day
Reply all
Reply to author
Forward
0 new messages