Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear attribute, transaction, for GoogleApi.Firestore.V1.Model.CommitRequest #11381

Open
ramyD opened this issue May 8, 2024 · 0 comments
Open
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@ramyD
Copy link

ramyD commented May 8, 2024

From the documentation, the transaction parameter for GoogleApi.Firestore.V1.Model.CommitRequest states:

transaction (type: String.t, default: nil) - If set, applies all writes in this transaction, and commits it.

However when setting this parameter to a string, such as:

batch_writes = %CommitRequest{ transaction: "anything", writes: writes }
Projects.firestore_projects_databases_documents_commit(conn, database, [body: batch_writes])

I get the response:

{:error,
 %Tesla.Env{
   method: :post,
   url: "http://localhost:45441/v1/projects/artifact-5-general/databases/local/documents:commit",
   query: [],
   headers: [{"content-type", "application/json"}],
   body: "{\"error\":{\"code\":400,\"message\":\"Invalid transaction.\",\"status\":\"INVALID_ARGUMENT\"}}",
   status: 400,
   opts: [],
   __module__: GoogleApi.Firestore.V1.Connection,
   __client__: %Tesla.Client{fun: nil, pre: [], post: [], adapter: nil}
 }}

It is unclear which values are eligible to the transaction attribute. Only nil and "" return an {:ok, %CommitResponse{}} response from Firestore.

I am using the Firestore emulator.

Environment details

  • Elixir version: IEx 1.16.1 (compiled with Erlang/OTP 24)
  • Google Cloud SDK 465.0.0
  • cloud-firestore-emulator 1.19.1
  • google_api_firestore version 0.24.0
@ramyD ramyD added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

1 participant