Bug inserting workers with decimal args
Closed this issue · 3 comments
daniikpando commented
Environment
- Oban PRO Version: v1.1.3
- Oban Version: v2.15.4
- PostgreSQL Version: 13
- Elixir & Erlang/OTP Versions: 1.14.5
Current Behavior
When I insert an Oban Worker with decimal arguments, It is inserting the argument like this:
%{"coef" => 10000, "exp" => 0, "sign" => 1}
So, When the worker is ready to be processed, the Oban validation fails because It can't cast this map()
to a Decimal.t()
value.
Here's how I configured the Oban Worker:
defmodule ObanWorker do
use Oban.Pro.Worker, queue: :example
args_schema do
field :amount, :decimal, required: true
end
def process(%Oban.Job{args: %__MODULE__{amount: amount}}) do
...
:ok
end
end
Here's how Oban Worker returns the error.
{:error, ":amount is invalid"}
Expected Behavior
Before this issue, it was inserting the Decimal values as string in the DB, it is unclear to me why the behavior was affected because Ecto Changeset expects the value in this way.
daniikpando commented
Hi @sorentwo, any news about it?
I already updated Oban to version 2.16.2, and I'm still having the same problem
sorentwo commented
@daniikpando This was fixed in Pro v1.1.4, released last week: https://oban.pro/releases/pro/v1.1#1.1.4
daniikpando commented
Ohhh, thanks @sorentwo!