pigeon
pigeon copied to clipboard
Unable to parse successful response
When I'm sending request to https://fcm.googleapis.com/fcm/send, I've got response { "message_id": 8112562628833817538}, which can't be parsed by Pigeon
2019-09-27 18:26:53.745 [error] GenServer #PID<0.790.0> terminating ** (FunctionClauseError) no function clause matching in Pigeon.Configurable.Pigeon.FCM.Config.parse_result/4 (pigeon) lib/pigeon/fcm/config.ex:154: Pigeon.Configurable.Pigeon.FCM.Config.parse_result("/topics/test2topic", %{"message_id" => 8112562628833817538}, #Function<4.17350067/1 in Pigeon.FCM.sync_push/2>, %Pigeon.FCM.Notification{collapse_key: nil, condition: nil, content_available: false, dry_run: false, message_id: nil, mutable_content: false, payload: %{"data" => %{"to" => "/topics/test2"}, "notification" => %{"data" => %{"score" => "5x1", "time" => "15:10"}, "to" => "/topics/test2"}}, priority: :normal, registration_id: "/topics/test2topic", response: [], restricted_package_name: nil, status: :success, time_to_live: 2419200}) (pigeon) lib/pigeon/connection.ex:113: Pigeon.Connection.process_end_stream/2 (gen_stage) lib/gen_stage.ex:2036: GenStage.noreply_callback/3 (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4 (stdlib) gen_server.erl:711: :gen_server.handle_msg/6 (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
That's all, because, response is not wrapped in results object Besides it uses legacy protocols. Maybe it's time to move to API v1?
Hi @aby2503, I'm working with Pigeon too in my company so maybe I can help but I don't understand what are are calling.
Are you using Pigeon.FCM.Notification.new()
and then Pigeon.FCM.push()
normally as said in doc?
I followed the code and HERE it seems it's correctly pattern matching results
object.
Another thing (not directly related): the first param in your Pigeon.Configurable.Pigeon.FCM.Config.parse_result
is /topics/test2topic
but the code expect a notification_id or a list of them
Let me know if it can help you