Azure-Samples / graphrag-accelerator

One-click deploy of a Knowledge Graph powered RAG (GraphRAG) in Azure
https://github.com/microsoft/graphrag
MIT License
1.89k stars 311 forks source link

[BUG] data.py /data/delete endpoint is throwing error message #181

Open daperez80 opened 1 month ago

daperez80 commented 1 month ago

Describe the bug Team is testing GraphRag Data Management API. We are able to list and upload containers but the delete operation fails

To Reproduce Steps to reproduce the behavior:

  1. Start backend server
  2. Go to localhost:port#/manpages/docs
  3. trigger the /data/delete/{storage_name}
  4. See error

Expected behavior Sucessfully delete the container both on cosmos and storage account.

Screenshots If applicable, add screenshots to help explain your problem. -- see attached

Desktop (please complete the following information):

Additional context GraphRag API is deployed to kubernetes as pod. We are running it via service / port forward to local host. Delete operations fail at File "/backend/src/api/data.py", line 208, in delete_files container_store_client.delete_item(

@data_route.delete( "/{storage_name}", summary="Delete a data storage container", response_model=BaseResponse, responses={200: {"model": BaseResponse}}, ) async def delete_files(storage_name: str): """ Delete a specified data storage container. """ sanitized_storage_name = sanitize_name(storage_name) try:

delete container in Azure Storage

    delete_blob_container(sanitized_storage_name)
    # update container-store in cosmosDB
    container_store_client = (
        azure_storage_client_manager.get_cosmos_container_client(
            database_name="graphrag", container_name="container-store"
        )
    )
    container_store_client.delete_item(
        item=sanitized_storage_name,
        partition_key=sanitized_storage_name

    )
except Exception:
    reporter = ReporterSingleton().get_instance()
    reporter.on_error(
        f"Error deleting container {storage_name}.",
        details={"Container": storage_name},
    )
    raise HTTPException(
        status_code=500, detail=f"Error deleting container '{storage_name}'."
    )
return BaseResponse(status="Success")
Screenshot 2024-09-24 at 8 50 04 PM