Skip to content

fix: run version compatibility check with the resolved API key credentials#132

Merged
Anush008 merged 4 commits into
qdrant:masterfrom
jamesm6162:fix/compatibility-check-credentials
Jun 23, 2026
Merged

fix: run version compatibility check with the resolved API key credentials#132
Anush008 merged 4 commits into
qdrant:masterfrom
jamesm6162:fix/compatibility-check-credentials

Conversation

@jamesm6162

Copy link
Copy Markdown
Contributor

Fixes #131

Problem

When credentials are set via withApiKey(...), the checkCompatibility health check in build() runs unauthenticated and logs "Failed to obtain server version" against auth-required servers (e.g. Qdrant Cloud). This regressed #96 (fixed in #97) starting in 1.18.0: the custom-headers refactor (49e4826) changed withApiKey() to defer building MetadataCredentials until after the compatibility check, so the check saw a null callCredentials.

Fix

Resolve the effective CallCredentials (explicit callCredentials, otherwise from apiKey/headers) before the compatibility check, and pass them into checkVersionsCompatibility(...). No public API change.

Test

Adds QdrantGrpcClientCompatibilityTest (uses the already-declared mockito-core, no live server required). It mocks the gRPC stub and asserts build() invokes the version check with the non-null MetadataCredentials derived from withApiKey(...). Verified that the test fails against the pre-fix code and passes with the fix.

The checkCompatibility health check in Builder.build() used this.callCredentials,
which withApiKey() no longer populates since the custom-headers refactor (49e4826,
released in 1.18.0): the api key MetadataCredentials are only constructed after the
check runs. Against an auth-required server (e.g. Qdrant Cloud) the check therefore
ran unauthenticated and logged "Failed to obtain server version", re-introducing qdrant#96.

Resolve the effective call credentials before running the check and pass them in.
Add a regression test asserting the check receives the api key credentials.

Fixes qdrant#131
@Anush008

Copy link
Copy Markdown
Member

Thanks for taking the time to contribute @jamesm6162

Comment thread src/test/java/io/qdrant/client/QdrantGrpcClientCompatibilityTest.java Outdated
@Anush008 Anush008 merged commit 23d68e5 into qdrant:master Jun 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants