Skip to content

system crash when checkout multiple products #87

@toreal

Description

@toreal

The error messages is as following.

look like MapSet has duplicate keys.

Parameters: %{}
15:36:14.367 [info] Replied cart:1 :ok
15:36:17.178 request_id=prhal3stab9270g36cpl80v9ibjl97o4 [info] POST /checkout/next
15:36:17.187 request_id=prhal3stab9270g36cpl80v9ibjl97o4 [info] Sent 500 in 0繕s
15:36:17.188 [error] #PID<0.636.0> running Nectar.Endpoint terminated
Server: localhost:443 (https)
Request: POST /checkout/next
** (exit) an exception was raised:
** (ArgumentError) error when merging the following Ecto.Multi structs:

%Ecto.Multi{names: #MapSet<[:variant_acquire_stock]>, operations: [variant_acquire_stock: {:changeset, #Ecto.Changeset<action: :update, changes: %{bought_quantity: 1, buy_count: 1}, errors: [], data: #Nectar.Variant<>, valid?: true>, []}]}

%Ecto.Multi{names: #MapSet<[:variant_acquire_stock]>, operations: [variant_acquire_stock: {:changeset, #Ecto.Changeset<action: :update, changes: %{bought_quantity: 1, buy_count: 1}, errors: [], data: #Nectar.Variant<>, valid?: true>, []}]}

both declared operations: [:variant_acquire_stock]

    (ecto) lib/ecto/multi.ex:171: Ecto.Multi.do_merge/3
    (elixir) lib/enum.ex:1755: Enum."-reduce/3-lists^foldl/2-0-"/3
    (nectar) web/workflows/checkout/payment.ex:39: Nectar.Workflow.Checkout.Payment.post_transition/3
    (ecto) lib/ecto/multi.ex:386: Ecto.Multi.apply_operation/5
    (elixir) lib/enum.ex:1755: Enum."-reduce/3-lists^foldl/2-0-"/3
    (ecto) lib/ecto/multi.ex:376: anonymous fn/5 in Ecto.Multi.apply_operations/5
    (ecto) lib/ecto/adapters/sql.ex:508: anonymous fn/3 in Ecto.Adapters.SQL.do_transaction/3
    (db_connection) lib/db_connection.ex:1275: DBConnection.transaction_run/4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions