[Tutor] Discovery service - api/v1/pathways 403

Hi everyone!

I’m trying Course Discovery using the tutor-discovery plugin, I want to use the Catalog and Program features.

I was able to install and apparently, it is working, but in the Caching programs step I’m getting an error to retrieve pathways. We have a 403 status code (Forbidden).

  • I already tried to add extra permissions to the lms_catalog_service_user account but it didn’t solve it.
  • I’m able to access this path by the browser logged in with an admin account.
  • I don’t understand why it’s happening only for this path, I believe all the imports are done using the lms_catalog_service_user account.

Here is the error when I run: tutor local run lms ./manage.py lms cache_programs.

2022-08-02 19:19:23,650 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:49 - populate-multitenant-programs switch is ON
2022-08-02 19:19:23,727 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:72 - Skipping site example.com. No configuration.
2022-08-02 19:19:23,765 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:147 - Requesting program UUIDs for local.overhang.io.
2022-08-02 19:19:24,024 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:153 - Received 1 UUIDs for site local.overhang.io
2022-08-02 19:19:24,027 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:165 - Requesting details for program fde4d27c-1cc5-40ba-9dbf-387323d002bc.
2022-08-02 19:19:24,182 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:182 - Requesting pathways for local.overhang.io.
2022-08-02 19:19:24,267 ERROR 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:191 - Failed to retrieve pathways for site: local.overhang.io.
Traceback (most recent call last):
  File "/openedx/edx-platform/openedx/core/djangoapps/catalog/management/commands/cache_programs.py", line 186, in get_pathways
    new_pathways = client.pathways.get(exclude_utm=1, page=next_page)
  File "/openedx/venv/lib/python3.8/site-packages/slumber/__init__.py", line 155, in get
    resp = self._request("GET", params=kwargs)
  File "/openedx/venv/lib/python3.8/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)
slumber.exceptions.HttpClientError: Client Error 403: http://discovery.local.overhang.io/api/v1/pathways/
2022-08-02 19:19:24,270 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:196 - Received 0 pathways for site local.overhang.io
2022-08-02 19:19:24,272 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:100 - Caching UUIDs for 1 programs for site local.overhang.io.
2022-08-02 19:19:24,276 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:107 - Caching ids for 0 pathways for site local.overhang.io.
2022-08-02 19:19:24,282 INFO 1 [openedx.core.djangoapps.site_configuration.models] [user None] [ip None] models.py:68 - Site Configuration is not enabled for site (local.overhang.io:8000).
2022-08-02 19:19:24,288 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:72 - Skipping site local.overhang.io:8000. No configuration.
2022-08-02 19:19:24,294 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:113 - Caching details for 1 programs.
2022-08-02 19:19:24,303 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:116 - Caching details for 0 pathways.
2022-08-02 19:19:24,310 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:119 - Caching programs uuids for 2 courses.
2022-08-02 19:19:24,357 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:122 - Caching programs uuids for 2 catalog courses.
2022-08-02 19:19:24,386 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:125 - Caching program UUIDs by 1 program types.
2022-08-02 19:19:24,409 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:128 - Caching program UUIDs by 1 program type slugs.
2022-08-02 19:19:24,426 INFO 1 [openedx.core.djangoapps.catalog.management.commands.cache_programs] [user None] [ip None] cache_programs.py:131 - Caching programs uuids for 0 organizations

I was able to create a Program and add two Courses to it:

Another point
In the Discovery documentation we have:

In order to cache programs in the LMS, you will need to manually create a catalog integration.

With this I understand, that the OpenedX core (without discovery) already has implemented Programs and what we are doing is: import the data from Discovery database to OpenedX database.
So, the question: am I able to create a Program in the OpenedX database end use it without Discovery?

I am also facing the same issue.

I believe this is being caused by lms_catalog_service_user in cache_programs, but I’m not quite sure how to resolve this. It

I ran the following commands:
tutor local run discovery ./manage.py update_index --disable-change-limit

tutor local run discovery ./manage.py refresh_course_metadata --partner_code=openedx

tutor local run discovery ./manage.py update_index --disable-change-limit

tutor local run lms ./manage.py lms create_catalog_integrations --enabled
–internal_api_url=“”
–service_username=lms_catalog_service_user

I also changed the catalog intergrations like so for testing:
tutor local run lms ./manage.py lms create_catalog_integrations --enabled
–internal_api_url=“[MY DISCOVERY URL]/api/v1”
–service_username=lms_catalog_service_user

I resolved this issue by running

tutor local run lms ./manage.py lms manage_user lms_catalog_service_user lms_catalog_service_user@openedx --staff --superuser --unusable-password

Then
tutor local run lms ./manage.py lms cache_programs

2 Likes

I am also facing the same issue. Are there any answers yet?