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
Addresses the second Copilot review on #2056:
- base.py: grpc_path_prefix now fails fast in _grpc_channel when used on a sync client
or when the weaviate-python-grpc-web shim is not active, instead of silently building
a native grpcio channel that ignores the prefix.
- helpers.py: connect_to_custom (sync) rejects a non-empty grpc_path_prefix and points
to use_async_with_custom; the docstring is clarified that grpc-web is async-only.
- _channel.py: _encode_timeout rounds the grpc-timeout up (math.ceil) so we never
advertise a shorter deadline than requested.
- proto/v1/__init__.py: the grpcio metadata fallback is restricted to Emscripten, so a
broken/partial grpcio install on a normal platform surfaces as PackageNotFoundError
instead of being masked by a fallback stub version.
Tests added/updated (sync/no-shim rejection, off-emscripten raise, grpc-timeout
round-up). End-to-end against a vanguard transcoder on a shared host:port still passes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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()`
314
315
or a username and password, in which case use `weaviate.classes.init.Auth.client_password()`.
315
316
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).
317
+
grpc_path_prefix: grpc-web base-path prefix. grpc-web is async-only, so it is NOT
318
+
supported by the synchronous ``connect_to_custom`` — passing a non-empty value
319
+
raises ``WeaviateInvalidInputError``. Use
320
+
``use_async_with_custom(..., grpc_path_prefix=...)`` instead. Defaults to None
321
+
(native gRPC).
321
322
322
323
Returns:
323
324
The client connected to the instance with the required parameters set appropriately.
@@ -350,6 +351,11 @@ def connect_to_custom(
350
351
True
351
352
>>> # The connection is automatically closed when the context is exited.
352
353
"""
354
+
ifgrpc_path_prefix:
355
+
raiseWeaviateInvalidInputError(
356
+
"grpc_path_prefix enables grpc-web, which is async-only; use "
357
+
"use_async_with_custom(...) instead of connect_to_custom(...)"
0 commit comments