ApiClient default HttpClient fails to connect if protocol version is not HTTP_1_1 #126
Open
6 tasks done
Labels
bug
Something isn't working
Checklist
Description
I am using the SDK to connect to an OpenFGA instance. I am using Java 21 (Liberica) and operate in a Spring Boot context.
Taken the following code:
everything works. The thing that made it working for me was setting the underlying HttpClients protocol to
HTTP_1_1
.if you replace
final var client = new OpenFgaClient(clientConfiguration, apiClient);
withfinal var client = new OpenFgaClient(clientConfiguration);
- using the defaultApiClient
and then do whatever call to OpenFGA the connection will not get established. Instead the SDK blocks the call unlimited until the server cancels the call by timeout.This is due to to an unrestricted call of the
CompletableFuture
in the functionexchangeToken()
:https://github.com/openfga/java-sdk/blob/main/src/main/java/dev/openfga/sdk/api/OpenFgaApi.java#L1165
Expectation
Not sure actually. Just wanted to bring that to the table. Maybe HTTP_1_1 should be set as default, as you can find a lot of issues regarding HTTP/2 and Java in the wild.
At least the call should not block indefinitely but rather use the configured timeouts.
Reproduction
OpenFGA SDK version
0.7.1
OpenFGA version
v1.8.0
SDK Configuration
Via Java SDK, see provided code snippets
Logs
There are no logs. The client just blocks until the server closes the connection after the server side timeout.
References
None.
The text was updated successfully, but these errors were encountered: