Giter VIP home page Giter VIP logo

Comments (13)

rslota avatar rslota commented on June 20, 2024

@ghard ,

There are two separate "issues" I can see here:

  1. The UNREGISTERED error should not be HTTP 500 - I have no idea why this happens, as this was a bug that has been recently "fixed". Can you please let me know if you're sure that this is 2.0.2 releases? And if it indeed is, can you share more logs surrounding this HTTP 500 UNREGISTERED? It really should've been HTTP 410.

  2. Deep data payloads - according to FCM documentation (https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#Notification), both keys and values in data have to be of type string. There is very little we can do about it apart from returning proper HTTP 400 code.

from mongoosepush.

rslota avatar rslota commented on June 20, 2024

@ghard ,

Actually, the error codes you show very much suggest you're using v2 API. Can you confirm that? If so, just try to switch to v3, the only changes are in response error codes (v2 used 500 for almost anything).

from mongoosepush.

ghard avatar ghard commented on June 20, 2024

cba7dc8b4e2c mongooseim/mongoose-push:2.0.2 "/opt/app/bin/mongoo…" 2 days ago Up 2 days 127.0.0.1:8443->8443/tcp mongoose-push

Re. v3 API: I would love to RTFM - however I don't Elixir and all examples and documentation ias n README.md refer to /v2 URLs only. I had no idea there even is such a thing as v3.

from mongoosepush.

rslota avatar rslota commented on June 20, 2024

Indeed, even though documentation reflects v3 changes (error code list), examples still show v2 in URL's - will fix that.

from mongoosepush.

ghard avatar ghard commented on June 20, 2024

Also:

$ curl http://localhost:8443/swagger.json
curl: (52) Empty reply from server

from mongoosepush.

rslota avatar rslota commented on June 20, 2024

Swagger is disabled in prod right now, only available when compiling from source in dev environment. In 2.1 this will be configurable.

from mongoosepush.

ghard avatar ghard commented on June 20, 2024

Maybe this could be exposed somewhere public, linked from the README.md?

from mongoosepush.

ghard avatar ghard commented on June 20, 2024

Never hurts to have an authoritative source for an API document somewhere.

from mongoosepush.

rslota avatar rslota commented on June 20, 2024

Yeah, that's true. I'll be pushing for external documentation anyway very soon, as README.md gets very crowded already - maybe Swagger (OpenAPI 3.0 after 2.1 release) could be part of that too.

from mongoosepush.

ghard avatar ghard commented on June 20, 2024

Swagger is somewhat standardised, so it is a good formal way of defining the API. If it is already a build artefact, it could easily be added as an item in releases as well - as a file one could also extract from the docker image, or separately.

from mongoosepush.

ghard avatar ghard commented on June 20, 2024

Okay. I am trying to send some test data to FCM - this is what my request JSON looks like:

"{\"service\":\"fcm\",\"topic\":\"com.example.app\",\"mode\":\"prod\",\"alert\":{\"title\":\"Hello\",\"body\":\"World oyster\"},\"data\":{\"event_data\":\"eyJtZWgiOiJib2luZyJ9\"}}"

I get an 200 reply and the alert gets shown on my 'droid. However the data payload is null.

This is what I see on the DEBUG log of MongoosePush - I'm having my worries about the notification as well as the data nodes being empty in what I suppose is being sent to FCM:

2020-03-17T11:09:41.172 [debug] pid=<0.1842.0> action=canceling_timer, request=%Sparrow.H2Worker.RequestState{body: "{\"message\":{\"android\":{\"data\":{\"event_data\":\"eyJtZWgiOiJib2luZyJ9\"},\"notification\":{\"body\":\"World oyster\",\"title\":\"Hello\"}},\"data\":{},\"notification\":{},\"token\":\"<redacted>\"}}", from: {#PID<0.28165.43>, #Reference<0.3784988276.708837377.52463>}, headers: [{"content-type", "application/json"}], path: "/v1/projects/myapp/messages:send", timeout: nil, timeout_reference: #Reference<0.3784988276.708837377.52470>}, result=4901

... stuff deleted ...

2020-03-17T11:09:41.173 [debug] pid=<0.28165.43> Sent 200 in 103ms

Am I still doing something wrong here? I've been successfully passing alerts with data payloads to our iOS clients with the v2 api for months so I guess I'm calling it correctly.

from mongoosepush.

rslota avatar rslota commented on June 20, 2024

@ghard,

I am not sure what is the issue here. There is .message.android.data filled according to you request in the log that you provided. The .message.data is indeed empty, but according to FCMv1 docs, .message.android.data overrides .message.data when available (https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#AndroidConfig).

from mongoosepush.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.