JUNIPER.MASTER - refresh_course_metadata - AttributeError: 'NoneType' object has no attribute 'get_jwt_access_token'

Hi,

i just moving forward running juniper.master release, now i’m on the EcommerceOscar, i was able to create coursesSeat on oscar, now i want to Create Program Offer.

I first create partner “create_or_update_partner” with this values:

–courses-api-url ‘https://lms.eduworld-cm.com/api/courses/v1/
–ecommerce-api-url ‘https://ecommerce.eduworld-cm.com/api/v2/
–organizations-api-url ‘https://lms.eduworld-cm.com/api/organizations/v0/

And then run this:

sudo -u discovery -Hs
source ~/discovery_env
/edx/bin/manage.discovery refresh_course_metadata

Here is the error log:

    2020-08-31 17:42:51,442 INFO 1603 [algoliasearch_django.registration] /edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/algoliasearch_django/registration.py:74 - REGISTER <class 'course_discovery.apps.course_metadata.algolia_models.AlgoliaProxyProduct'>
2020-08-31 17:42:52,492 INFO 1603 [course_discovery.apps.course_metadata.management.commands.refresh_course_metadata] /edx/app/discovery/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py:116 - Command is not using threads to write data.
2020-08-31 17:42:52,494 INFO 1603 [course_discovery.apps.course_metadata.management.commands.refresh_course_metadata] /edx/app/discovery/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py:153 - Executing Loader [https://lms.eduworld-cm.com/api/courses/v1/]
2020-08-31 17:42:52,494 ERROR 1603 [course_discovery.apps.course_metadata.management.commands.refresh_course_metadata] /edx/app/discovery/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py:28 - CoursesApiDataLoader failed!
Traceback (most recent call last):
  File "/edx/app/discovery/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py", line 25, in execute_loader
    loader_class(*loader_args).ingest()
  File "/edx/app/discovery/discovery/course_discovery/apps/course_metadata/data_loaders/__init__.py", line 31, in __init__
    self.username = self.get_username_from_client(self.api_client)
  File "/edx/app/discovery/discovery/course_discovery/apps/course_metadata/data_loaders/__init__.py", line 41, in get_username_from_client
    token = client.get_jwt_access_token()
AttributeError: 'NoneType' object has no attribute 'get_jwt_access_token'
2020-08-31 17:42:52,496 INFO 1603 [course_discovery.apps.course_metadata.management.commands.refresh_course_metadata] /edx/app/discovery/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py:153 - Executing Loader [https://ecommerce.eduworld-cm.com/api/v2/]
2020-08-31 17:42:52,496 ERROR 1603 [course_discovery.apps.course_metadata.management.commands.refresh_course_metadata] /edx/app/discovery/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py:28 - EcommerceApiDataLoader failed!
Traceback (most recent call last):
  File "/edx/app/discovery/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py", line 25, in execute_loader
    loader_class(*loader_args).ingest()
  File "/edx/app/discovery/discovery/course_discovery/apps/course_metadata/data_loaders/api.py", line 295, in __init__
    super(EcommerceApiDataLoader, self).__init__(partner, api_url, max_workers, is_threadsafe, **kwargs)
  File "/edx/app/discovery/discovery/course_discovery/apps/course_metadata/data_loaders/__init__.py", line 31, in __init__
    self.username = self.get_username_from_client(self.api_client)
  File "/edx/app/discovery/discovery/course_discovery/apps/course_metadata/data_loaders/__init__.py", line 41, in get_username_from_client
    token = client.get_jwt_access_token()
AttributeError: 'NoneType' object has no attribute 'get_jwt_access_token'
CommandError: One or more of the data loaders above failed.

Need help to continue my friends :pray:t2:

Have you setup your Partner information with the same information in Django Admin in Course Discovery?

As this also shows errors about JWT access token, I wonder if you created the tokens for the different applications.

See the Inter-service Communication Impact section under
https://openedx.atlassian.net/wiki/spaces/COMM/pages/940048716/Juniper

and

https://openedx.atlassian.net/wiki/spaces/COMM/pages/1532395987/Setup+OAuth+Client+for+Internal+Services+Django+Oauth+Toolkit+version

1 Like

Yes

Using the Native Installation, with open-release/juniper.master, it comes already configured, so it generated users, i just check it and all is good, backendUsers and configuration settings

It was definitely that, i just edit the partner, filled those fields in Discovery DjangoAdmin:

Name: Open edX
Code abbrégé : edX
URL du LMS : https://lms.eduworld-cm.com/
LMS Admin URL : https://lms.eduworld-cm.com/admin/
L'url du Studio : http://lms.eduworld-cm.com:18010/
URL de l'API Cours : https://lms.eduworld-cm.com/api/courses/v1/
URL de l'API Commerce électronique : https://ecommerce.eduworld-cm.com/api/v2/
URL de l'API Organisations : https://lms.eduworld-cm.com/api/organizations/v0/

then run refresh_course_metadata works now well!

1 Like