Closed mohe2015 closed 4 years ago
I've been out from the push notif industry for a while, but I remember some versions of Firefox giving this error when the TTL
is not set. Try to set it in your request to some number and see if it works.
I know there are not much in the errors due to servers not giving us that much. It's annoying when you try to debug bugs...
Ah, now when I read your code I see you actually set the TTL. This error means the subscription link is not valid anymore. Could this be a path Firefox started taking to not wanting to flood the user with notifications? Did you try to re-subscribe and does it work then? Also your TTL is quite long, try something shorter, like 60 seconds and see if they accept your notification with that.
Changing the TTL didn't work. I added logging (see #19) and got the following:
TRACE web_push::client > Request: Request { method: POST, uri: https://updates.push.services.mozilla.com/wpush/v2/gAAAAABeWkyLOXj8oNYzkKQrq2Q_Fq4_PHlZhX2WAh___9XGCTWmScTW0oSFPd7sgeDLbvf3kbNaxlA1vL5lU7s1nbLY9lc-OD1rP2njC4FTJtw3f0mvyUgI3xvDj4FpoCs4XnNKuI5F1AXUkbHPCSPCwBbMkZOTp6lTEGPA-7dYIYKAW_Zljek, version: HTTP/1.1, headers: {"ttl": "5184000", "content-encoding": "aesgcm", "content-length": "3070", "content-type": "application/octet-stream", "authorization": "WebPush eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJodHRwczovL3VwZGF0ZXMucHVzaC5zZXJ2aWNlcy5tb3ppbGxhLmNvbSIsImV4cCI6MTU4MzAxOTM0MCwic3ViIjoibWFpbHRvOnRlc3RAZXhhbXBsZS5jb20ifQ.aVKOnjg0HjH83-4ysrMIxucP2WMewCpaDGT1YUNXjMWipTCykFBz08DcF3MZNCxXUV_yxHFQGxNCsey9fzmu-Q", "crypto-key": "dh=BBMJz-08FsBSnK_0OkNWvmnHRy2dl95yNCen2WqEdpoPwLfwIl1dacgW1hygxPs560WuWagSAZnx3Y9u1CqomDs; p256ecdsa=BAvD4b287z3xfU293G2JSKXybiHv-19mNhzlvQmmDk9drnsWhPpeSC6d9uCThC4y4abw4gjyxA8YX9Z7rk4PfvI", "encryption": "salt=YdgV60QQqIHIje1hN70sww"}, body: Body(Full(b"...")) }
TRACE web_push::client > Response: Response { status: 410, version: HTTP/1.1, headers: {"access-control-allow-headers": "content-encoding,encryption,crypto-key,ttl,encryption-key,content-type,authorization", "access-control-allow-methods": "POST", "access-control-allow-origin": "*", "access-control-expose-headers": "location,www-authenticate", "cache-control": "max-age=86400", "content-type": "application/json", "date": "Sat, 29 Feb 2020 11:35:40 GMT", "server": "nginx", "strict-transport-security": "max-age=31536000;includeSubDomains", "content-length": "193", "connection": "keep-alive"}, body: Body(Streaming) }
TRACE web_push::client > Response status: 410 Gone
TRACE web_push::client > Body: [123, 34, 99, 111, 100, 101, 34, 58, 32, 52, 49, 48, 44, 32, 34, 101, 114, 114, 110, 111, 34, 58, 32, 49, 48, 53, 44, 32, 34, 101, 114, 114, 111, 114, 34, 58, 32, 34, 34, 44, 32, 34, 109, 111, 114, 101, 95, 105, 110, 102, 111, 34, 58, 32, 34, 104, 116, 116, 112, 58, 47, 47, 97, 117, 116, 111, 112, 117, 115, 104, 46, 114, 101, 97, 100, 116, 104, 101, 100, 111, 99, 115, 46, 105, 111, 47, 101, 110, 47, 108, 97, 116, 101, 115, 116, 47, 104, 116, 116, 112, 46, 104, 116, 109, 108, 35, 101, 114, 114, 111, 114, 45, 99, 111, 100, 101, 115, 34, 44, 32, 34, 109, 101, 115, 115, 97, 103, 101, 34, 58, 32, 34, 82, 101, 113, 117, 101, 115, 116, 32, 100, 105, 100, 32, 110, 111, 116, 32, 118, 97, 108, 105, 100, 97, 116, 101, 32, 67, 114, 105, 116, 105, 99, 97, 108, 32, 70, 97, 105, 108, 117, 114, 101, 58, 32, 77, 105, 115, 115, 105, 110, 103, 32, 83, 101, 110, 100, 101, 114, 73, 68, 34, 125]
TRACE web_push::client > Body text: Ok("{\"code\": 410, \"errno\": 105, \"error\": \"\", \"more_info\": \"http://autopush.readthedocs.io/en/latest/http.html#error-codes\", \"message\": \"Request did not validate Critical Failure: Missing SenderID\"}")
DEBUG web_push::client > Response: Err(EndpointNotValid)
Err(EndpointNotValid)
Beause of
{
"code":410,
"errno":105,
"error":"",
"more_info":"http://autopush.readthedocs.io/en/latest/http.html#error-codes",
"message":"Request did not validate Critical Failure: Missing SenderID"
}
I assume it is using a Bridge with the google FCM as a backend.
The autopush docs say:
Each bridge may require a unique token that addresses the remote application For GCM/FCM, this is the SenderID (or ‘project number’) and is pre-negotiated outside of the push service. You can find this number using the Google developer console. For APNS, this value is the “platform” or “channel” of development (e.g. “firefox”, “beta”, “gecko”, etc.) For our examples, we will use a client token of “33clienttoken33”.
Could this be some missing claims.. Are you using vapid?
Yeah I'm using vapid. The bridge documentation seems to not be relevant for the end user. It is documentation for how mozilla's autopush works internally. It seems that this issue is already known https://github.com/mozilla-services/autopush/issues/843#issuecomment-286594430 and I could fix it by reinstalling firefox. Unfortunately I now get the error "GCM recipient not available." and can't find out how to resolve it. Strangely it works when I use https://github.com/web-push-libs/web-push and I don't have the time to find out what's wrong. Therefore I will switch to that implementation.
Hi,
I don't know if you can even help me or if I just messed something up. I'm a Rust novice so yeah...
I'm using your library in a project and the push notifications work in all cases (Chrome on all tested platforms, Firefox 73.0.1 on Linux)
e.g.
(not valid any more so I should be fine I think)
except on Firefox for Android 68.5.0:
To me these look the same but I can't find out why one works and the other doesn't. Do you have any idea?
The server side code is https://github.com/mohe2015/albertforfuture.de/tree/master/web-push (please don't judge me for the code...) and the client side code if required is https://github.com/mohe2015/albertforfuture.de/blob/master/themes/albertforfuture.de/assets/index_template.js#L93 including some really ugly gohugo hacks that nobody should look at. But I doubt it that the client side is at fault - I think this problem isn't even at your side.
I would really appreciate any help even if it's just explaining how I can get more logging output from this library.
Thanks a lot in advance.
Moritz
P.S.: The website I'm testing this on is https://albertforfuture.de/ although it's in german. Please don't look at the articles as they are written really badly :D. You should be able to just press the bell at the top and then wait for a few seconds. I hope my server is still up if you want to test it.