Closed mrluc closed 9 years ago
After digging into the codebase, I see that the issue is that addict is feeding an Ecto-based struct to Poison and telling it to encode it to iodata, and it dies because of fields like __struct__
that it can't serialize.
Turns out, that's been fixed in git, just not the hex.pm package. Switching to git deps for addict solved it for me.
Sorry, will update the hex.pm package with the latest changes :+1:
Published 0.1.0
I am sure it is an encoding error which gets reflected in the stack-trace here. I guess I should look for answers in the controller AppController. Is that the case ?
08:40:17.418 request_id=nMaM8lZOYm06c6PuI4C3 [info] Processing by Grandcentral.Api.AppController.index/2
Parameters: %{"format" => "json"}
Pipelines: [:api, :any_auth]
08:40:17.639 request_id=nMaM8lZOYm06c6PuI4C3 [info] Sent 500 in 240ms
08:40:17.656 [error] #PID<0.495.0> running Grandcentral.Endpoint terminated
Server: gc-dev.zappos.biz:4000 (http)
Request: GET /api/apps
** (exit) an exception was raised:
** (Poison.EncodeError) unable to encode value: {nil, "apps"}
(poison) lib/poison/encoder.ex:339: Poison.Encoder.Any.encode/2
(poison) lib/poison/encoder.ex:213: anonymous fn/4 in Poison.Encoder.Map.encode/3
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map."-encode/3-lists^foldl/2-0-"/3
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map.encode/3
(poison) lib/poison/encoder.ex:213: anonymous fn/4 in Poison.Encoder.Map.encode/3
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map."-encode/3-lists^foldl/2-0-"/3
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map.encode/3
(poison) lib/poison/encoder.ex:232: anonymous fn/3 in Poison.Encoder.List.encode/3
So, actions like /register take appropriate database effect, but explode trying to return a json response with the aforementioned error.
Unfortunately the Poison error thrown gives a stacktrace that's very unhelpful! So I rather have to guess that this is happening in
Addict.Controller
'sregister
code when it tries to calljson conn, message
, as this happens with default addict routes handling the/register
POST: