clearlydefined / clearlydefined/service
API Errors when searching
- Dominant language
- TypeScript
- Stars
- 51
- Forks
- 46
- PR merge metrics
- No merged PRs in 30d
Description
Looking through our infrastructure logs, I see lots of errors along these lines:
```
Error=2, Details='Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: af78cca2-48d9-4cf2-94a9-3582e86a0b3e; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: af78cca2-48d9-4cf2-94a9-3582e86a0b3e; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: af78cca2-48d9-4cf2-94a9-3582e86a0b3e; Reason: (Message: {"Errors":["The order by query does not have a corresponding composite index that it can be served from."]}
ActivityId: af78cca2-48d9-4cf2-94a9-3582e86a0b3e, Request URI: /apps/a46235ed-1a53-4c89-a8e9-d794eafe62dc/services/ebb0f78c-59f5-4118-a7d8-6ecec766c9e8/partitions/ecdbff82-b39a-4b15-9251-23164d1c09dd/replicas/132612174938199725s/, RequestStats: Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum, SDK: Windows/10.0.17763 cosmos-netstandard-sdk/3.18.0);););
```
These are being generated by API calls like these:
* http://api.clearlydefined.io/definitions?type=pypi&provider=pypi&name=marquez-assertion&sort=namespace&sortDesc=false
* http://api.clearlydefined.io/definitions?type=pypi&provider=pypi&name=microcosm-sqlite&sort=namespace&sortDesc=false
* http://api.clearlydefined.io/definitions?type=pypi&provider=pypi&name=methodtools&sort=namespace&sortDesc=false
And indicate that something is wrong with the way we are calling our MongoDB when searching
Contributor guide
Research direction
Start by reproducing the three /definitions requests shown in the issue and inspect the resulting API and infrastructure logs. Trace the search call to determine why the database rejects the order-by query, then verify that these searches complete without the 400 composite-index error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, mongodb, typescript
- Domain
- api, backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100