You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(grpc-web): support grpc-web on the REST host:port via a base-path prefix
Add a configurable gRPC base-path prefix so the client can talk to a grpc-web
endpoint multiplexed onto the REST host:port (the production wire contract:
grpc-web served under "/grpc-web/" via an in-process transcoder).
- ConnectionParams gains `grpc_path_prefix`, threaded through `from_params` /
`from_url` and the `connect_to_custom` / `use_async_with_custom` helpers.
Normalized to a single leading slash, no trailing slash; None/"" == native gRPC.
- `_check_port_collision` no longer rejects the same host:port when a grpc-web
prefix is set; native gRPC (no prefix) still raises, unchanged.
- `_grpc_channel` forwards the prefix to the transport as a
("grpc-web.path_prefix", prefix) channel option only in grpc-web mode, so the
native channel options stay byte-for-byte unchanged.
- weaviate-python-grpc-web: the shim's channel factories read that option and
GrpcWebChannel prepends the prefix, so requests go to
<scheme>://<host>:<port><prefix>/weaviate.v1.Weaviate/<Method>.
Tested: new ConnectionParams unit tests (collision relaxed only with a prefix;
native same-port still raises; option forwarded/omitted) and grpc-web transport
tests for the prefixed/normalized URL. End-to-end verified against a vanguard
transcoder on a shared host:port (insert_many/fetch_objects/aggregate over
grpc-web with grpc_host == http_host == localhost:8090).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
"""Connect to a Weaviate instance with custom connection parameters.
295
296
@@ -312,6 +313,11 @@ def connect_to_custom(
312
313
a bearer token, in which case use `weaviate.classes.init.Auth.bearer_token()`, a client secret, in which case use `weaviate.classes.init.Auth.client_credentials()`
313
314
or a username and password, in which case use `weaviate.classes.init.Auth.client_password()`.
314
315
skip_init_checks: Whether to skip the initialization checks when connecting to Weaviate.
316
+
grpc_path_prefix: Optional base-path prefix for a grpc-web endpoint served on the
317
+
same host:port as REST (e.g. "/grpc-web"). When set, gRPC requests are sent
318
+
over grpc-web to ``<scheme>://<grpc_host>:<grpc_port><prefix>/...`` and sharing
319
+
the REST host:port is allowed. Requires the ``weaviate-python-grpc-web``
320
+
package. Defaults to None (native gRPC).
315
321
316
322
Returns:
317
323
The client connected to the instance with the required parameters set appropriately.
"""Create an async client object ready to connect to a Weaviate instance with custom connection parameters.
592
600
@@ -609,6 +617,11 @@ def use_async_with_custom(
609
617
a bearer token, in which case use `weaviate.classes.init.Auth.bearer_token()`, a client secret, in which case use `weaviate.classes.init.Auth.client_credentials()`
610
618
or a username and password, in which case use `weaviate.classes.init.Auth.client_password()`.
611
619
skip_init_checks: Whether to skip the initialization checks when connecting to Weaviate.
620
+
grpc_path_prefix: Optional base-path prefix for a grpc-web endpoint served on the
621
+
same host:port as REST (e.g. "/grpc-web"). When set, gRPC requests are sent
622
+
over grpc-web to ``<scheme>://<grpc_host>:<grpc_port><prefix>/...`` and sharing
623
+
the REST host:port is allowed. Requires the ``weaviate-python-grpc-web``
624
+
package. Defaults to None (native gRPC).
612
625
613
626
Returns:
614
627
The client connected to the instance with the required parameters set appropriately.
0 commit comments