Accenture / EcoSonar

EcoSonar, the ecodesign audit tool
https://ecosonar.org/
GNU Affero General Public License v3.0
54 stars 19 forks source link

"The index path corresponding to the specified order-by item is excluded." when trying to retrieve analysis #21

Closed ewanklomp closed 1 year ago

ewanklomp commented 1 year ago

Whenever I want to retrieve the EcoSonar analysis on my project I get the following error messages.

image

After some debugging I found out that I am getting back a 500 Internal server error on the following API call: /api/greenit/project?projectName=

The specific error it produces is: "The index path corresponding to the specified order-by item is excluded." image

After some analysis I found out that this is a specific issue for the CosmoDB implementation for mongoDB: https://learn.microsoft.com/en-us/answers/questions/258032/the-index-path-corresponding-to-the-specified-orde https://learn.microsoft.com/en-us/answers/questions/385230/the-index-path-corresponding-to-the-specified-orde

I am guessing it has something to do with the find commands in this function: https://github.com/Accenture/EcoSonar/blob/main/EcoSonar-API/dataBase/greenItRepository.js#L109

(It happens for all analysis, not only for greenit but also for lighthouse and wc3).

As my javascript and mongodb knowledge is limited I can't fix it so I am curious whether you understand what is going on and how to fix it.

alicehaupais commented 1 year ago

Hello Ewan, As per our discussion, I have updated the Github documentation to include MongoDB collections setup : https://github.com/Accenture/EcoSonar/tree/main/EcoSonar-API#mongodb-collections

In your case, you will need to define in the terraform scripts the collections with their related indexes. https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cosmosdb_mongo_collection