braze-inc / braze-web-sdk

Public repo for the Braze Web SDK
https://www.braze.com
Other
73 stars 26 forks source link

Ghost Notifcations #14

Closed trevorrjohn closed 7 years ago

trevorrjohn commented 8 years ago

Hey, so I am seeing this weird issue where I will get a notification saying "The site was updated in the background." It seems to be shown when other push messages are coming in, however this notification has no icon and is not clickable.

Screenshot:

screen shot 2016-10-20 at 1 22 56 pm

I am not sure if this is coming from the server or if it being displayed by the web-sdk. Any thoughts?

froodian commented 8 years ago

Hi @trevorrjohn,

Unfortunately this message is something that the browser creates and displays on its own in certain situations, notably when it doesn't think that we're displaying our own notification (which, obviously we are, given that the other notification is on-screen simultaneously).

I've generally only see this occur with registrations created on older browsers (which didn't support payloads natively, and had to resort to what I call "tickle-and-fetch", where the browser receives a dataless "tickle" from the server, and then needs to "fetch" the actual push notification). In that scenario, if two pushes are sent in rapid succession and then the browser tries to fetch both simultaneously, this can occur.

In this case, what version of the browser is installed? What version was installed when the push registration occurred? Is this happening with all pushes you receive, or only occasionally? When you're seeing this, were multiple pushes recently sent in rapid succession to that user? I ask these questions to try to determine if this is like the scenario I describe above, or if there's some other edge case that is causing the browser to determine that we're not displaying a foreground push that we received in certain scenarios.

If you're using Chrome, I'd also be interested in what you see if you navigate to chrome://serviceworker-internals/ - do you see only one entry for your site, and if so, what are the "Installation Status"/"Running Status"/"Script" values for that entry? Is there anything in the "Log" area?

If you're more comfortable answering these questions privately, feel free to follow up via desk ticket, just mention my name when you file it and it'll come back around to me.

trevorrjohn commented 8 years ago

Hi @froodian,

Thanks for the info.

This is occurring in the latest version of Chrome (53.0.2785.143). I believe that this is the version installed when push registration occurred. This is just happening occasionally. It seems that it happens when opening Chrome for the first time in the morning or when turning on my computer, although not all the time.

Installation Status: ACTIVATED
Running Status: RUNNING
Version ID: 1117
Renderer process ID: 29007
Script: https://<domain>.com/service-worker.js 
Renderer thread ID: 28171
DevTools agent route ID: 3

There was nothing in the log area, but if I see the notification again I will go back and check again.

Just to note, one of my teammates also saw this notification and he was using Vivaldi. (Not a big concern, but thought I should let you know.)

Let me know if there is any other info that would be helpful.

trevorrjohn commented 8 years ago

Just to follow up here, I just saw another ghost notification. I check the logs, but nothing was showing.

froodian commented 8 years ago

Thanks for the info @trevorrjohn,

I'm sorry to hear that the registration is so recent, this is the first confirmation I've had of this issue still occurring under current conditions.

The "first time in the morning" info is particularly interesting, to muse for a second, I wonder if this has to do somehow with a push being sent while the machine is offline, with no Chrome helper process running, or the network being down - or maybe with multiple push being sent under those conditions, and then both getting delivered simultaneously when the process wakes up or network connectivity is restored.

We'll spend some time digging into this and look for a more reliable way to consistently suppress these notifications.

trevorrjohn commented 8 years ago

Hey @froodian any update on this? We are seeing this quite a bit on all of our sites at the moment. Still not seeing any errors in the console.

froodian commented 8 years ago

Hi @trevorrjohn,

Unfortunately we have not had much luck reproducing this issue on our end. I've done some research and debugging, and it appears the general conditions that could cause this ghost push are:

In order to determine whether the issue is due to a bug in Appboy's service worker, I've released version 1.6.3 of the web sdk which includes increased logging in the service worker - could you:

I'll also reach out to you privately in order to get a good user id for us to look for in our server-side logging.

Sorry that this issue has been so hard to track down, hopefully these steps can help us drive towards resolution.

froodian commented 7 years ago

Looping back around to note that @trevorrjohn and I debugged this issue down to a backend bug on our part and patched it - it should now be resolved globally with no sdk upgrades required. Let me know if anybody else continues to experience this behavior, and thanks for your debugging help @trevorrjohn - closing out this issue.