Support .env Configuration for Weaviate gRPC Health Check Host
Self Checks
- [x] I have read the Contributing Guide and Language Policy.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] Please do not modify this template :) and fill in all the required fields.
1. Is this request related to a challenge you're experiencing? Tell me about your story.
Currently, Dify does not support configuring Weaviate's gRPC health check host via .env file. This becomes problematic when deploying Weaviate using the official Helm chart, as it exposes two separate services:
weaviate:8080 (HTTP)
weaviate-grpc:50051 (gRPC)
The current implementation in Dify uses the same host for both HTTP and gRPC connections, which doesn't work with this deployment pattern.
2. Additional context or comments
Allow configuration of gRPC host and port through environment variables, similar to how other Weaviate connection parameters are configured.
Current Code In the Weaviate client initialization, the gRPC host and port are hardcoded to use the same host as HTTP:
python def _init_client(self, config: WeaviateConfig) -> weaviate.WeaviateClient: """ Initializes and returns a connected Weaviate client.
Configures both HTTP and gRPC connections with proper authentication.
"""
p = urlparse(config.endpoint)
host = p.hostname or config.endpoint.replace("https://", "").replace("http://", "")
http_secure = p.scheme == "https"
http_port = p.port or (443 if http_secure else 80)
grpc_host = host # Currently uses same host as HTTP
grpc_secure = http_secure
grpc_port = 443 if grpc_secure else 50051
Suggested Changes Add environment variables to configure gRPC host and port separately:
WEAVIATE_GRPC_HOST - for gRPC host configuration
WEAVIATE_GRPC_PORT - for gRPC port configuration
The code should be modified to use these environment variables when available, falling back to the current behavior if they're not set.
3. Can you help us with this feature?
- [ ] I am interested in contributing to this feature.
A quick workaround for this issue is setting .Values.grpcService.enabled=false and both HTTP and gRPC routing will be merged as a single service:
kubectl get svc -n $NAMESPACE | grep weaviate
weaviate ClusterIP 10.43.167.250 <none> 80/TCP,50051/TCP 2d1h
weaviate-headless ClusterIP None <none> 80/TCP 2d1h
A quick workaround for this issue is setting
.Values.grpcService.enabled=falseand both HTTP and gRPC routing will be merged as a single service:kubectl get svc -n $NAMESPACE | grep weaviate weaviate ClusterIP 10.43.167.250
80/TCP,50051/TCP 2d1h weaviate-headless ClusterIP None 80/TCP 2d1h
My mistake, setting .Values.grpcService.enabled=false alone doesn't workaround this issue. The workaround should be:
kubectl patch svc -n $NAMESPACE weaviate --type='json' -p='[{"op": "add", "pat
h": "/spec/ports/-", "value": {"name": "grpc", "protocol": "TCP", "port": 50051, "targetPort": 50051}}]'
service/weaviate patched