Force Deletion of Connectors

If you must delete a connector and related information before the process of waiting for the background jobs to run, you can run a deletion script using the instructions that follow.

This is not default behavior. Use sparingly

How to find a connector ID?

  1. Navigate to the connectors page.

  1. Click on the connector you want the ID of .

  1. On the connector’s page, the URL’s final number will be the ID of the connector. For example, in this example, the connector’s ID is 2. Here is also a more zoomed in photo of the URL bar.

m

Deleting Locally

  1. Gather the ID of the connector you wish to delete.

  2. Navigate to the base folder of your Danswer repository.

  3. Run python3 backend/scripts/force_delete_connector_by_id.py <CONNECTOR_ID>

Deleting in Docker Compose

Follow these steps to manually and immediately delete a connector and its contents within a container:

  1. Ensure your Docker containers are running- you can refer to the quickstart guide:

    docker compose -f docker-compose.dev.yml -p danswer-stack up -d --build --force-recreate
    
  2. Identify the <CONTAINER_ID> of your API server container. It should contain the string danswer-api. You can list all running containers with:

    docker ps -a
    
  3. Gather the ID <CONNECTOR_ID> of the connector you wish to delete.

  4. Run the deletion script inside the Docker container:

    docker exec -it <CONTAINER_ID> python scripts/force_delete_connector_by_id.py <CONNECTOR_ID>
    

    Replace <CONTAINER_ID> with your actual API container ID, and <CONNECTOR_ID> with the ID of the connector you want to delete.

    For example:

    docker exec -it 92492089ada1 python scripts/force_delete_connector_by_id.py 10
    
  5. The script will execute inside the container, accessing the necessary resources and performing the deletion.

Troubleshooting

  • If you encounter permission issues, you may need to run the docker-compose command with sudo:

    sudo docker-compose exec <CONTAINER_ID> python /app/scripts/force_delete_connector_by_id.py `CONNECTOR_ID`
    
  • Ensure that your user has the necessary permissions to execute docker-compose commands.

  • If the script is not found, verify the path to the script within your Docker container.