-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Checklist
- I have looked into the README and have not found a suitable solution or answer.
- I have looked into the documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have upgraded to the latest version of OpenFGA and the issue still persists.
- I have searched the Slack community and have not found a suitable solution or answer.
- I agree to the terms within the OpenFGA Code of Conduct.
Description
Summary
Response headers are not being returned in ClientWriteResponse objects for write operations when using transaction mode (the default).
Impact
- Affected versions: v0.9.0, v0.9.1, v0.9.2
- Affected operations: All write operations in transaction mode:
write()writeTuples()deleteTuples()
Root Cause
When non-transaction write support was added in v0.9.0, the ClientWriteResponse class added a constructor that hardcodes empty headers:
File: src/main/java/dev/openfga/sdk/api/client/model/ClientWriteResponse.java
Line: 24
public ClientWriteResponse(List<ClientWriteSingleResponse> writes, List<ClientWriteSingleResponse> deletes) {
this.statusCode = 200;
this.headers = Collections.emptyMap(); // ❌ Headers hardcoded to empty map
this.rawResponse = "";
this.writes = writes != null ? writes : Collections.emptyList();
this.deletes = deletes != null ? deletes : Collections.emptyList();
}This constructor is appropriate for non-transaction mode, which aggregates results from multiple API calls. However, it's also being used by OpenFgaClient.writeTransactions() at line ~510, which makes a single API call and should preserve the headers from that response.
Expectation
Expected Behavior
Write operations should return response headers in ClientWriteResponse, allowing users to access HTTP response metadata.
Actual Behavior
response.getHeaders() returns an empty map {} for all write operations in transaction mode.
Reproduction
Sample:
ClientWriteRequest request = new ClientWriteRequest()
.writes(List.of(new ClientTupleKey()
.user("user:anne")
.relation("reader")
._object("document:budget")));
ClientWriteResponse response = fgaClient.write(request).get();
Map<String, List<String>> headers = response.getHeaders();
System.out.println(headers); // Prints: {}OpenFGA SDK version
0.9.2
OpenFGA version
N/A (affects all versions)
SDK Configuration
Standard ClientConfiguration initialization - bug is not configuration-dependent
Logs
No response
References
Additional Context
- The bug was introduced in v0.9.0 (released Aug 15, 2025)
- The issue occurs in multiple locations where
ClientWriteResponseis constructed:- Line ~510 in
writeTransactions()(transaction mode) - Line ~656 in
writeNonTransaction()(non-transaction mode) - Line ~713 in
writeTuples() - Line ~759 in
deleteTuples()
- Line ~510 in
- This does not affect read operations, check operations, or other client methods that correctly preserve headers
Metadata
Metadata
Assignees
Labels
Type
Projects
Status