Failed to get VAPID

Hi.

I followed the walkthrough to setup habot behind myopenhab.org.
As soon as I test notifications, I get “Error while getting the public VAPID key from the server: Error: Request failed with status code 500”

A little debugging shows the result of the call to https://home.myopenhab.org/rest/habot/notifications/vapid

“{“error”:{“message”:“Cannot get the VAPID keypair for push notifications”,“http-code”:500,“exception”:{“class”:“java.lang.RuntimeException”,“message”:“Cannot get the VAPID keypair for push notifications”,“localized-message”:“Cannot get the VAPID keypair for push notifications”,“cause”:“java.nio.file.NoSuchFileException”}}}”

Can anyone give me some advice here?

exception in logs:
2021-07-27 15:15:33.512 [ERROR] [internal.JSONResponseExceptionMapper] - Unexpected exception occurred while processing REST request.

java.lang.RuntimeException: Cannot get the VAPID keypair for push notifications

at org.openhab.ui.habot.notification.internal.NotificationService.loadVAPIDKeys(NotificationService.java:196) ~[?:?]

at org.openhab.ui.habot.notification.internal.NotificationService.getVAPIDPublicKey(NotificationService.java:87) ~[?:?]

at org.openhab.ui.habot.rest.internal.HABotResource.webPushConfig(HABotResource.java:209) ~[?:?]

at jdk.internal.reflect.GeneratedMethodAccessor403.invoke(Unknown Source) ~[?:?]

caused by exception:




Caused by: java.nio.file.NoSuchFileException: /var/lib/openhab/habot/vapid_keys

	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) ~[?:?]

	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]

	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) ~[?:?]

	at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219) ~[?:?]

	at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:478) ~[?:?]

	at java.nio.file.Files.newOutputStream(Files.java:220) ~[?:?]

	at java.nio.file.Files.write(Files.java:3425) ~[?:?]

	at java.nio.file.Files.writeString(Files.java:3641) ~[?:?]

	at java.nio.file.Files.writeString(Files.java:3581) ~[?:?]

Should that file be generated somehow?

Managed to solve it by manually generating the file with values from an online key generator.
It remains unsolved why the generation mechanism didn’t work here…

This should happen, I traced it down to a regression introduced by

On this line:

The open option should be CREATE or CREATE_NEW (or in addition to TRUNCATE_EXISTING).

OK, that makes sense.
I’ll be happy to test it in a further release - in the mean time, I think I can work well with the workaround.

Did you by any chance have a look at my other post too?
Send notifications via jython script - Apps & Services / HABot - openHAB Community