Skip to content

.NET SDK bug: (Write query) StoreId from query options is not used when transactions are disabled #431

@laerva1801

Description

@laerva1801

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 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

https://github.com/openfga/dotnet-sdk/blob/8144f2679d29e073ac206691128e3561cdbe1f26/src/OpenFga.Sdk/Client/Client.cs#L226

When using the Write operation in the .NET SDK, StoreId from the options is ignored when transactions are disabled. The StoreId set directly on the client is used instead.

AuthorizationModelId from the options is respected - the same should happen for storeId.

Expectation

StoreId provided in ClientWriteOptions should be read and used regardless of transactions being enabled or not.

Reproduction

  1. Given you have an OpenFgaClient instantiated with a specific storeId (call this "Id 1") provided in ClientConfiguration.
  2. When using the Write operation in the SDK, with transaction set to disabled in the options AND a storeId provided, e.g.
new ClientWriteOptions() {
 StoreId = "<Id 2">,
 AuthorizationModelId = "<some authorization model id>",
 Transaction = new TransactionOptions()
   {
       Disable = true
   }
}
  1. Then the storeId provided in the ClientWriteOptions is not used, and the StoreId set in ClientConfiguration is instead used. (Tuple write goes to storeId "Id 1", not "Id 2" that was provided in query

SDK Checklist

  • JS SDK
  • Go SDK
  • .NET SDK
  • Python SDK
  • Java SDK

OpenFGA SDK version

0.5.1

OpenFGA version

1.6.1

SDK Configuration

Not relevant

Logs

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions