Closed tsightler closed 4 months ago
OK, I think I figured this out, current versions require not just firebase configuration, but also requires vapidKey, which requires using generate key pair for web push certificates. Maybe this should be noted in the docs as previous versions used a default vapidKey if none was provided. Without providing a vapidKey, the GCM registration fails.
Hi. I'am glat that you've found a way to make it work.
That seems to be a new one. I've noticed that it stopped working with the default vapidKey passed a few times without any. It seems that I'll have to make it a required parameter. Luckily for us, the vapidKey is also provided by creating a firebase project so it's just one more variably to copy.
Well, work is probably optimistic, I'm not getting any error and it appears to be working based on debug logs, but, so far, I've been unable to successfully receive any messages.
To be clear, I can receive messages with the example, if I send a message within my own registered application, however, I need to receive push message from another 3rd-party application which I don't control, other than I can tell it the FCM token it should use to push messages. This was working perfectly with 3.x push-receiver (and still does) but, so far, I can't receive messages from it with 4.x push-receiver. Hopefully I'm still just doing something wrong, but at least it is progress.
Any sender that you want to receive messages from should use the same vapid key. You can try to use the firebase generic vapid key which was used in the previous versions
BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4
It seems not possible to register with GCS when using this key. If I use my generated VAPID key, registration works, but I receive no messages from 3rd-party. I tried changing the VAPID key after registration, but that didn't seem to work either. I'm not sure what is going on, it could be some other issues in my code for sure.
It seems not possible to register with GCS when using this key. If I use my generated VAPID key, registration works, but I receive no messages from 3rd-party. I tried changing the VAPID key after registration, but that didn't seem to work either. I'm not sure what is going on, it could be some other issues in my code for sure.
Ok let's check your end. If you enable debug and trigger message from 3rd party, can you see any logs that PushReceiver is receiving data?
No, I never see any data received. Last night I decided to give @aracna/fcm library a try since it uses a somewhat different method for registering with Firebase. Unfortunately, it behaves pretty much exactly the same, I can register and connect, but never receive any messages. It seems clear that I'm using the correct parameters to register because if I change any single property value, the registration fails with various errors (not found, unauthorized, etc, based on what specific value is incorrect).
This indicated to me that there was something else I was missing, so I did some additional reverse engineering on the 3rd party app and noticed a property in the metadata that appears to be a recent change. This property is sent along with the FCM token to the app and appears to be indicating use of a new push notification method. I'm thinking that perhaps the API on the sending side has to change as well for the client to be able to receive message, and this parameter may be instructing the server side app to use the new API. I'm going to try that at some point in the next few days.
Regardless, as far as I can see, push-receiver is working as expected, and it's not up to you to help me reverse engineer receiving push notifications for some 3rd party tool, so I'm going to go ahead and close this as the initial issue is resolved, VAPID seems to be required to successfully register and can no longer be the default VAPID. Thanks for your help!
I feel like I'm just being dense here, but I just can't get this new version to work. Created a new project and have my firebaseConfig credentials, however, this doesn't even seem to be where the issue is as it fails with the GCM registration. Just using the provided example I put in my firebase credentials, but it doesn't even get to the stage of registering with FCM because the GCM registration fails:
This retries 5 times and then eventually exits with this:
Looking through the code, it seems like this portion of the code is unchanged from previous versions, but I'm not sure if legacy GCM registration is working anymore, however, it's possible I'm completely off-base.