async def connect_to_qdrant(self) -> None:
        """Connect to Qdrant service with appropriate authentication."""
        if self.client is None:
            try:
                # Configure client
                if self.url:
                    location = self.url
                else:
                    location = settings.qdrant_url

                client_config = {
                    "location": location,
                    "prefer_grpc": False,  # Use HTTP by default
                }

                if location[-4:] != ":6333":
                    # allow railway to work
                    client_config["port"] = None

                # Add API key if provided
                api_key = self.api_key
                if api_key:
                    client_config["api_key"] = api_key

                # Initialize client
                self.client = AsyncQdrantClient(**client_config)

                # Test connection
                await self.client.get_collections()
                logger.info("Successfully connected to Qdrant service.")
            except Exception as e:
                logger.error(f"Error connecting to Qdrant service at {location}: {e}")
                self.client = None
                # Provide more specific error messages
                if "connection refused" in str(e).lower():
                    raise ConnectionError(
                        f"Qdrant service is not running or refusing connections at {location}"
                    ) from e
                elif "timeout" in str(e).lower():
                    raise ConnectionError(
                        f"Connection to Qdrant service timed out at {location}"
                    ) from e

                elif "authentication" in str(e).lower() or "unauthorized" in str(e).lower():
                    raise ConnectionError(
                        f"Authentication failed for Qdrant service at {location}"
                    ) from e
                else:
                    raise ConnectionError(
                        f"Failed to connect to Qdrant service at {location}: {str(e)}"
                    ) from e
Connect to Qdrant service with appropriate authentication.
backend/airweave/platform/destinations/qdrant.py