Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpush not received #7

Open
bkupidura opened this issue Sep 24, 2024 · 6 comments
Open

Webpush not received #7

bkupidura opened this issue Sep 24, 2024 · 6 comments

Comments

@bkupidura
Copy link

bkupidura commented Sep 24, 2024

Hello,
Im just testing nodebb-plugin-web-push and was not able to received any notification on any of my devices (IOS/MacOS).
Tested in Firefox and Chrome.

Send Test Notification button in user settings is also not working.

There is no errors in console.

Here is service-worker code visible from developer mode:

'use strict';

self.addEventListener('fetch', function (event) {
	// This is the code that ignores post requests
	// https://github.com/NodeBB/NodeBB/issues/9151
	// https://github.com/w3c/ServiceWorker/issues/1141
	// https://stackoverflow.com/questions/54448367/ajax-xmlhttprequest-progress-monitoring-doesnt-work-with-service-workers
	if (event.request.method === 'POST') {
		return;
	}

	event.respondWith(caches.match(event.request).then(function (response) {
		if (!response) {
			return fetch(event.request);
		}

		return response;
	}));
});

nodebb-plugin-web-push version 0.6.2
nodebb version 3.9.0 (docker container)

Im aware that "not working" is not super helpfull.
Are there any steps i can perform trying to nail down what is a root cause?

Webpush notifications are working for other pages running on same webbrowser.

@julianlam
Copy link
Member

Can you confirm that the service worker is actually loaded? There's old code that specifically avoids loading the service worker on Safari. Not sure if this applies to you.

It is a tall ask but can you also try on an android device, just to rule the apple part out?

@julianlam
Copy link
Member

There is no errors in console.

What about server side?

@julianlam
Copy link
Member

Here is service-worker code visible from developer mode:

Just realized that if that's your service worker you need a new service worker, it is outdated 🙂

@bkupidura
Copy link
Author

  1. Service worker is loaded and running. Im not using Safari. Unfortunately not owning any android device.

  2. No errors also on server side

  3. I just checked, and same service-worker code is returned by https://{my-forum-domain}/service-worker.js, so even if i unregister worker and register fresh one - it will have still same content.

Can you point me new version of SW? In NodeBB github service-worker.js looks exactly the same - https://github.com/NodeBB/NodeBB/blob/05e4307e5a84e867b48e591b4f1407a9ef2afc93/public/src/service-worker.js

Should i see second SW, registered by this plugin?

@julianlam
Copy link
Member

You'll need to manually replace the service worker with the one from the activitypub branch.

This plugin is only meant to be used with the upcoming NodeBB v4.

That should fix your issue I think.

@julianlam
Copy link
Member

Latest web-push plugin should work with 3.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants