/api/measures/component returns 404

Using version 8.0. Hitting the API with /api/measures/component to retrieve coverage. Most of several dozen repos return the unit test coverage metric but a few return a 404 error. The ‘component’ value used in the URL is the value retrieved via /api/projects/search. So the component value is known to SonarQube but it cannot return the coverage metric. Why? Under what conditions would the API return a 404 for /api/measures/component? I’ve investigated the repos that have these errors and at least some seem to be active and current.

Thanks

Hi,

Welcome to the community!

Is it consistent about which component searches return a 404? At a guess, this is not about SonarQube but about SonarQube’s visibility on your network. Because if only the query string is changing - and not the path - you should get an error from the web service, not an error contacting the web service. I guess you’re going through some sort of proxy or firewall which is periodically mangling values…?

 
Ann

It is consistent for the component. Each time I run my script (across multiple days), the same 85 projects are retrieved, and then when I ask for the coverage metric for each project I get 404s on the same 23 projects.

Hi,

If you eliminate the query string, I guess you reach the web service but get an error from it. This really indicates to me that there’s something in the middle on your network that’s interfering.

You should talk to your network folks.

 
:woman_shrugging:
Ann

Hi,
I have the same issue when accessing project section on the UI. /api/measures/search returns 404, but when using port 9000 it works.
Finally found the root cause: it is a length limit for query string

2 Likes