Skip to content

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

Open
@ramyD

Description

@ramyD

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions