Remove 404 error on the browser for modules not found in Addon Index

Hello everyone I am working on the Addon Manager module, so i made an api request to the addon index https://addons.openmrs.org/, to retrieve list of developers/maintainers of all module. It was successful but the problem is that not all modules are listed in the addon index and so the modules not listed return a 404 error in the browser console as shown below.

I have looked at https://github.com/openmrs/openmrs-contrib-addonindex the addonindex repository, so i can return null if the module dose not exist. But i can’t seem to find a way around it

cc @dkayiwa @suthagar23 @ivange94 @judeniroshan

I agree you should address this, but I’m surprised to see all those modules not in the add-on index. Maybe we’re doing something wrong either on the query side or on the add-on index side.

Thank you @darius for the heads-up. I think i found the bug. The way i got the developers name from the addon index was to concatenate https://addons.openmrs.org with the packageName key property of each modules.

So i discovered that the value of some packageName key do not match the value on the addon index url, hence the 404 error.

For example the Legacy UI Module exist on the addon index but it returns 404 because the value of the packageName: https://addons.openmrs.org/#/show/org.openmrs.module.legacyui does not match ‘https://addons.openmrs.org/#/show/org.openmrs.module.legacyui’ If all the value in packageName are uniform with the addon index, then it would be solved.

What are your thought? 38 PM

You have correctly noted that the internal uids in the addon index don’t always match the modulePackage (which is what “org.openmrs.module.legacyui” is technically called within OpenMRS).

The REST call you want is:

GET .../api/v1/addon?modulePackage=org.openmrs.module.legacyui
1 Like

Thanks @darius. It works! :smiley:

1 Like

Yah, it will definitely work. I used this while working on SysAdmin OWA.