We’re running Progressive Web Applications with push notifications enabled for Chrome and Samsung Internet, and encourage our users to add it to their home screen. We scrupulously log and monitor browser exceptions to preserve a high-quality service.
Since May 22, 2018, we have noticed a sudden rise of puzzling JavaScript exceptions originating from calls to standard, feature-detected Web APIs that had previously never failed.
For example, the following code would produce the following error, despite “push” clearly being a valid value per Permissions.query() specs:
const permissionStatus = await navigator
.permissions
.query({ name: 'push', userVisibleOnly: true });
💥 TypeError: Failed to read the 'query' property from 'Permissions': The provided value 'push' is not a valid enum value of type PermissionName.
Upon closer inspection, we noticed that all such errors happened during script execution by user agents that are not our actual customers. Rather, we see an unknown client query our application right after our user visiting:
This unknown client performs a HTTP Request bearing characteristic patterns:
What’s more, these requests only occur intermittently, in a seemingly controlled way, as reflected by the dates above and the graph below:
This, and the fact that we detect usage of “Add to Home Screen” in most cases, make us wonder if this could be an experiment having to do with WebAPKs. However, this is undocumented, and thus very puzzling.
What is this unknown Google-originating client?
What is its purpose?
How should developers detect them, and what measures should be taken?
August 2018 Update: Requests such as described above seem to have vanished completely now… But they could have been some sort of prototype of a somehow-similar kind of requests we’re seeing now. These requests of a new kind are still originating from Google servers, and seem to exclusively target the Web Manifest of our PWA, therefore no JavaScript error is triggered anymore. They all bear a Chrome/59+ user agent string clearly postfixed (via Google-Chrome-WebAPK)
. Other browsers, such as Samsung Internet, have yet to be spotted.
This might be a headless Chrome (probably pre-release tests, in case you have it in the Play Store), which does not feature push
permission; eg. with Pupeteer, one can only override permissions, but not really accept the permission prompt... and there generally is no desktop attached, where one could push notifications to.
Just try
and catch
to sort out clients not supporting push
permission.
navigator.permissions
.query({name: 'push', userVisibleOnly: true})
.then(function(permissionStatus) {
console.log('push permission state is ', permissionStatus.state);
})
.catch((error) => {
console.warn(error);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With