ash-project / ash_json_api

The JSON:API extension for the Ash Framework
https://hexdocs.pm/ash_json_api
MIT License
62 stars 42 forks source link

error retrieving relationships (one to many) #51

Closed peillis closed 3 years ago

peillis commented 3 years ago
Request: GET /models_api/1/screens/2/relationships/device_screens
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in IO.chardata_to_string/1
        (elixir 1.11.2) lib/io.ex:589: IO.chardata_to_string(nil)
        (elixir 1.11.2) lib/path.ex:520: Path.join/2
        (ash_json_api 0.28.2) lib/ash_json_api/serializer.ex:538: AshJsonApi.Serializer.at_host/2
        (ash_json_api 0.28.2) lib/ash_json_api/serializer.ex:8: AshJsonApi.Serializer.serialize_to_many_relationship/4
        (ash_json_api 0.28.2) lib/ash_json_api/controllers/response.ex:77: AshJsonApi.Controllers.Response.render_many_relationship/4
        (layer 1.1.54) lib/plug/router.ex:284: Layer.Api.AshJsonApi.Api.Router.dispatch/2
        (layer 1.1.54) /home/enrique/jobs/ash_json_api/lib/ash_json_api/api/router.ex:62: Layer.Api.AshJsonApi.Api.Router.plug_builder_call/2
        (phoenix 1.5.9) lib/phoenix/router/route.ex:41: Phoenix.Router.Route.call/2
        (phoenix 1.5.9) lib/phoenix/router.ex:352: Phoenix.Router.__call__/2
        (layer 1.1.54) lib/layer_web/endpoint.ex:1: LayerWeb.Endpoint.plug_builder_call/2
        (layer 1.1.54) lib/layer_web/endpoint.ex:1: LayerWeb.Endpoint."call (overridable 3)"/2
        (layer 1.1.54) lib/plug/debugger.ex:136: LayerWeb.Endpoint."call (overridable 4)"/2
        (layer 1.1.54) lib/layer_web/endpoint.ex:1: LayerWeb.Endpoint.call/2
        (phoenix 1.5.9) lib/phoenix/endpoint/cowboy2_handler.ex:65: Phoenix.Endpoint.Cowboy2Handler.init/4
        (cowboy 2.9.0) /home/enrique/jobs/live-layer/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
        (cowboy 2.9.0) /home/enrique/jobs/live-layer/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
        (cowboy 2.9.0) /home/enrique/jobs/live-layer/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
        (stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
zachdaniel commented 3 years ago

Hey @peillis, thanks for the issue report. Can you try out master and see if it works for you now? {:ash_json_api, github: "ash-project/ash_json_api"}.

peillis commented 3 years ago

Hi @zachdaniel, the issue happens with the master branch. I have a local copy cloned from github.

zachdaniel commented 3 years ago

Did you update it since I pushed a potential fix? If so, could I see the new stacktrace?

peillis commented 3 years ago

ah ok, sorry I didn't notice the commit. Right now I can't test it, tomorrow I'll check it. Thank you!

peillis commented 3 years ago

Right, it works! Thank you

zachdaniel commented 3 years ago

released as 0.28.3