Closed allanbatista closed 6 years ago
Do you mind sharing the solution here in case anyone else has a similar problem?
I ran into the same issue :-( I'm using:
{:ecto, "~> 2.1.0"},
{:mongodb_ecto, "~> 0.2.0"},
{:mongodb, "~> 0.4.6"},
It seems it's breaking when doing IO.iodata_length(iodata)
when iodata
is the query encoded by encode_op(op_query(...)
Previously, I was using ecto 2 and the 0.2.0 of the mongo driver. This happened after I upgraded the dependencies. I'm not sure, but I wonder if it's a problem with my Mongo version -- any idea if that could be related?
Also, forgot to mention:
This fails
MyApp.Repo.get(MyApp.Planbook, "5b23e072240bee0007a1a82e")
But this works:
Mongo.find(MyApp.Repo.Pool, "planbooks_", %{_id: BSON.ObjectId.decode!("5b23e072240bee0007a1a82e")}) |> Enum.to_list()
I would have thought they both would have failed given the error message, so I'm a bit confused.
When you say it fails, do you mean an actual error, or does it just not find the record? What if you do
MyApp.Repo.one(from p in MyApp.Planbook, where: p.id == ^"5b23e072240bee0007a1a82e"
We took a break in upgrading to Ecto 2.1, but we're back and figured it out. It turned out to be some odd compile related issue. I changed my dockerfile from this:
# Before
RUN mix deps.clean --all --build && mix deps.get && mix deps.compile
...
RUN mix compile
To this
RUN mix deps.clean --all --build && mix deps.get && mix deps.compile
...
RUN mix compile && mix deps.clean mongodb && mix deps.get mongodb && mix deps.compile mongodb
And it worked. So odd.
This error is raise when use phoenix 1.3.2 in production only with server. When use console ("iex -S mix") works fine.
ELIXIR VERSION
Repo config
Mix Lock
APPLICATION LOG