How to PATCH / PUT campaign via API?
dompie opened this issue · comments
Dominik Piekarski commented
Philipp commented
Could you share the logs from your Keila instance?
Dominik Piekarski commented
Where can I find the logs? I'm not into Elexir app architecture...
Philipp commented
How are you running Keila? The logs are outputted to stdout by the application when you run it.
Dominik Piekarski commented
I'm running it in the docker container. Found the logs:
18:41:34.579 request_id=F73v-vOvJ_7jlmgAAbih [info] PATCH /api/v1/campaigns/nmc_Mvg6QDVZ
18:41:34.585 request_id=F73v-vOvJ_7jlmgAAbih [info] Sent 500 in 5ms
18:41:34.586 [error] #PID<0.14628.0> running KeilaWeb.Endpoint (connection #PID<0.14627.0>, stream id 1) terminated
Server: keila.local:4000 (http)
Request: PATCH /api/v1/campaigns/nmc_Mvg6QDVZ
** (exit) an exception was raised:
** (ArgumentError) could not put/update key :id on a nil value
(elixir 1.15.7) lib/access.ex:419: Access.get_and_update/3
(elixir 1.15.7) lib/map.ex:957: Map.get_and_update/3
(elixir 1.15.7) lib/kernel.ex:2817: Kernel.put_in/3
(keila 0.14.0) lib/keila_web/api/controllers/api_campaign_controller.ex:83: KeilaWeb.ApiCampaignController.update/2
(keila 0.14.0) lib/keila_web/api/controllers/api_campaign_controller.ex:1: KeilaWeb.ApiCampaignController.action/2
(keila 0.14.0) lib/keila_web/api/controllers/api_campaign_controller.ex:1: KeilaWeb.ApiCampaignController.phoenix_controller_pipeline/2
(phoenix 1.6.11) lib/phoenix/router.ex:354: Phoenix.Router.__call__/2
(keila 0.14.0) lib/keila_web/endpoint.ex:1: KeilaWeb.Endpoint.plug_builder_call/2
I have also double-checked on campaigns index the given id exists.
Best regards
Philipp commented
Could you try providing {"settings": {}}
as part of the campaign object? This might fix the issue for now until I'm able to add a proper fix.
Dominik Piekarski commented
Yes, providing "settings": {}"
attribute allows saving (although settings will reset to settings: {type: text}
) - but works for me now.