Jump to content

"Push notification keys missing"


Luuuk
 Share

Go to solution Solved by Stuart Silvester,

Recommended Posts

Hi,

After upgrading to 4.6.8 I enabled the PHP GMP extension and rebooted server. PHP 7.4.1, the extension is detected as enabled:

obraz.png.81686ba242ce1cece4d21a240c360345.png

But I get the following error:

obraz.png.4d3955ffa36a76cc50449a0c6d50eebf.png

obraz.png.58821fb5b6bfd1e40fe43f717d241247.png

From System logs:

Quote

11/15/2021 11:42 PM     create_vapid_keys     RuntimeException (0) Unable to create the key   

 

Edited by Luuuk
Link to comment
Share on other sites

Could you elaborate what "does not work" and "is not supported" exactly means?

Modern Windows Server fully supports PWA (including Push). I meet all requirements: PHP version (and actually I upped it to PHP 8.0), enabled modules (gmp, mbstring, curl, openssl). The thing which fails is writing VAPID keys to some JSON file. So could you tell me where / which JSON file I have to look at? The error points to permissions.

For the record, browsers do detect a service worker but fire an error related to JSON:

obraz.png.e04b57fcf094378ad89579b17577aa23.png

obraz.png.3e80103b4200437d2745015e56688900.png

 

Edited by Luuuk
Link to comment
Share on other sites

2 minutes ago, Luuuk said:

Could you elaborate what "does not work" and is "not supported" exactly means?

Modern Windows Server fully supports PWA (including Push). I meet all requirements: PHP version (and actually I upped it to PHP 8.0), enabled modules (gmp, mbstring, curl, openssl). The thing which fails is writing VAPID keys to some JSON file. So could you tell me where / which JSON file I have to look at? The error points to permissions.

For the record, browsers do detect a service worker but fire an error related to JSON:

obraz.png.e04b57fcf094378ad89579b17577aa23.png

obraz.png.3e80103b4200437d2745015e56688900.png

 

Unfortunately, we do not provide support for Windows servers. It may be that it requires further configuring on your server or otherwise. I am happy to move this topic to our peer-to-peer server support forum for further assistance once we address the second issue there.

The latter there may be a bug and unrelated as there are service workers running outside of the push notification. What is being returned there is not JSON thus the Javascript is failing to parse the string into a JSON object. This could be your Windows server is generating an error page that was not anticipated but I would expect the above to catch that. However, when viewing your community, I am seeing that the service worker is running fine without error. Could you please clarify where and which user you're seeing this with? I can then investigate this further.

Link to comment
Share on other sites

12 minutes ago, Jim M said:

However, when viewing your community, I am seeing that the service worker is running fine without error. Could you please clarify where and which user you're seeing this with? I can then investigate this further.

As pointed out, my ACP Support page returns "Push notification keys missing" because VAPID keys can't be saved somewhere. Seeing my community as a Guest or Admin in the Chrome Developer Console show service worker as running and no error until I test the "Push" option in the console.

EDIT: I clarified that the error is shown regardless of being logged or not.

Edited by Luuuk
Link to comment
Share on other sites

33 minutes ago, Luuuk said:

Seeing my community as a Guest or Admin in the Chrome Developer Console show service worker as running and no error until I test the "Push" option in the console.

Unfortunately, I cannot reproduce this. I would suggest clearing your browser's cache and trying again. There are no errors in the browser console:

image.png

Link to comment
Share on other sites

  • Solution

Vapid key generation failure on Windows is typically (and this is pretty much all Windows web servers) because the openssl.cnf file either isn't configured properly or cannot be located/used by your PHP instance.

Take a look at https://stackoverflow.com/a/18869750. If you can get it to work, that's great! Just please note that we cannot assist with server configuration issues.

Link to comment
Share on other sites

15 hours ago, Stuart Silvester said:

Vapid key generation failure on Windows is typically (and this is pretty much all Windows web servers) because the openssl.cnf file either isn't configured properly or cannot be located/used by your PHP instance.

Thanks a lot! I fixed the error by creating the OPENSSL_CONF environment variable set to C:\Program Files\PHP\v8.0\extras\ssl\openssl.cnf and rebooting server. Get Support page generated the keys and Push option appeared in the users Notification settings.

=======================================

But I still have issues.. Push option enabled in the users settings + accepted in the browser's prompt but no Push messages at all. Something like reported here. Also the odd thing is that a service worker is detected by browsers but Google says:

obraz.png.7ad336a4d93cf92a4fdb8b5dadfbcaae.png

 

16 hours ago, Jim M said:

Unfortunately, I cannot reproduce this. I would suggest clearing your browser's cache and trying again. There are no errors in the browser console

Clearing site's data does not help. I still see the JSON error generated after I click this:

obraz.png.8395fe1a8f5d9271640a7775caf3e6ab.png

Edited by Luuuk
Link to comment
Share on other sites

I will also add that I see a service worker in Chrome (returning the error during the "Push" test) and Firefox but not in Microsoft Edge:

obraz.png.869461e81524f38bd0ad8c4470135225.png

Service worker is added after I manually select Edge menu > Apllications > Install "My site". And then the worker returns the same error as in Chrome.

 

Edited by Luuuk
Link to comment
Share on other sites

Thank you for clarifying. The test push notification in devtools is also failing here. I have tagged someone from our dev team to further clarify. However, it is key to understand, the service worker is working and push notifications should work in the software itself. If they are not, please let us know.

Link to comment
Share on other sites

2 hours ago, Jim M said:

However, it is key to understand, the service worker is working and push notifications should work in the software itself. If they are not, please let us know.

Like I said:

9 hours ago, Luuuk said:

Push option enabled in the users settings + accepted in the browser's prompt but no Push messages at all. Something like reported here.

 

I also think it is not normal that Edge does not create the worker automatically and does not detect my site as "installable" in the address bar (no icon). So I need to use the Edge dropdown menu to add "My site" application which results in the service worker being added too...

EDIT: Something is not right and results are inconsistent. I just have encountered the same issue as in Edge but in Chrome on other PC where I never opened my site. No service worker detected and no "Install application" prompt. So on two different Windows PCs different results in Chrome.

Edited by Luuuk
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...