Program creation > Authoring organisation images are broken on LMS and Credentials

Hi all!
We’re facing the issue connected to certificate_logo_image now.

While creating the program on the course-discovery service we’re adding authoring organizations to it.
Those organizations have been configured previously in the course-discovery and all kinds of images were added to them

Info about the program along with the image URLs is fetched by copy_catalog (for credentials) and cache_programs (for the LMS) management commands.

BUT those images are broken anywhere they are used

The problem is that Discovery’s API returns image URLs as relative ones (/media/organizations/bla-bla-bla), so LMS and Credentials are trying to find them in their own storage.

That all looked like a bug and I’ve tried to search for any related issues here and in the edx slack chats but found nothing (which confused me). Am I missing something? Or maybe the program’s feature is just not so popular so I’ve been the first to discover that? (I don’t believe it :slight_smile:)

Thanks :pray:

Hi @Evgen_Dyudyunov
Could you please check what is value of MEDIA_URL setting in your course discovery instance?

Hi, @Zia_Fazal
Here are course discovery settings:

MEDIA_URL = 'http://localhost:18381' + LOCAL_DISCOVERY_MEDIA_URL

All devstack default.

As I described in the post the images are accessible if to use absolute URL, but Credentials and LMS receive them as relative ones.

I was asking about the discovery-maple-dev instance as shown in the screenshot. If hit orgnizations API on discovery
do you get absolute URL in certificate_logo_image_url field?

@Zia_Fazal here is an example response from the discovery-maple-dev instance:

            "uuid": "62043e45-9e45-479c-8f99-9faf4270036b",
            "key": "demo",
            "name": "Demo Organization",
            "auto_generate_course_run_keys": true,
            "certificate_logo_image_url": "/media/organization/certificate_logos/62043e45-9e45-479c-8f99-9faf4270036b-0e9a09c10e4c.png",
            "description": "",
            "description_es": "",
            "homepage_url": null,
            "tags": [],
            "logo_image_url": "/media/organization/logos/62043e45-9e45-479c-8f99-9faf4270036b-e0bc545bedd1.png",
            "marketing_url": "school/demo",
            "slug": "demo",
            "banner_image_url": "/media/organization/banner_images/62043e45-9e45-479c-8f99-9faf4270036b-12fc6d743c6d.png"

I think @Zia_Fazal is on the right track here.

We’ve had this working for awhile now but the organizations API doesn’t return a relative path.

I’m doing my work via devstack and in Discovery I’m using the default devstack settings in

# See:
MEDIA_ROOT = root('media')
# LOCAL_MEDIA_URL was added to support external services like edx-mktg retrieving
# static files in DEBUG and local Devstack
MEDIA_URL = 'http://localhost:18381' + LOCAL_DISCOVERY_MEDIA_URL

When I hit http://localhost:18381/api/v1/organizations/ the response is…

    "count": 1,
    "next": null,
    "previous": null,
    "results": [
            "uuid": "ffb9f98f-8307-4162-b4fc-34ccf20e9eb0",
            "key": "edX",
            "name": "edX",
            "auto_generate_course_run_keys": true,
            "certificate_logo_image_url": "http://localhost:18381/media/organization/certificate_logos/ffb9f98f-8307-4162-b4fc-34ccf20e9eb0-5d945f86db8b.png",
            "logo_image_url": "http://localhost:18381/media/organization/logos/ffb9f98f-8307-4162-b4fc-34ccf20e9eb0-d0868227bd53.png",
            "description": "",
            "description_es": "",
            "homepage_url": null,
            "tags": [],
            "marketing_url": "school/edx",
            "slug": "edx",
            "banner_image_url": "http://localhost:18381/media/organization/banner_images/ffb9f98f-8307-4162-b4fc-34ccf20e9eb0-99eddce4c9c2.png",
            "enterprise_subscription_inclusion": false

Which has the full URL, not a relative path.

In Credentials, when the copy_catalog management command is run, we create/update the organization on the Credentials side with the result in this API call without any modification of the data.

Is it possible your MEDIA_URL settings in Discovery are wrong or being overwritten somehow?

1 Like

Oh, I see

I was pretty sure we use the default settings without any modifications for media at least in the devstack, so I was looking for the reasons elsewhere. I’m going to check that. I’ll bring the results here later.

Thank you!

All image urls returned by /api/v1/organizations/ including certificate_logo_image_url should be absolute URLs instead of relative. It appears MEDIA_URL setting in discovery instance does not have http scheme and host prefix.

1 Like

How can I mark both of your answers as a solution? :sweat_smile:

Changing the MEDIA_URL solved the problem

Thank you, @jhynes @jhynes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.