Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to parse successful response #156

Open
aby2503 opened this issue Sep 27, 2019 · 1 comment
Open

Unable to parse successful response #156

aby2503 opened this issue Sep 27, 2019 · 1 comment

Comments

@aby2503
Copy link

aby2503 commented Sep 27, 2019

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?

@macciomauro
Copy link

macciomauro commented Oct 24, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants