I switched from gcm to vapid about a week ago following the instructions on the html5 push notifications component page. It seemed to work fine until this morning when I started to receive a message that the push failed with a 403 forbidden error
Had anyone else seen this? I’m at loss where to look, I haven’t changed anything apart from following the migration instructions.
And when you say it was working till this morning, what changed? Did the machine your HASS is running off of reboot? Did the computer you were getting HTML5 notifications reboot? Did the router reboot? What changed?
Yes, I use nginx for reverse proxy, but that isn’t new. I don’t believe the router or the docker host (QNAP TS-451+ running Container Station) was rebooted. There is a pending firmware update, but I haven’t updated yet.
Thanks for the link to the documentation, I hadn’t seen that. I’ll check my nginx config.
Same problem here. Entered the public, private, and email field. Registered my PC (Firefox) and phone (Android) and sent a test message. My PC received the notification directly, while it also gave a 403 error from Google (my phone).
I’ve migrated from FCM to Vapid, and since my PC received it I assume all is good on my end. I have no reverse proxy or whatever.
In the Google Cloud Console (not Firebase Console), search the Library for fcm and make sure the Firebase Messaging API is enabled. I saw that in another form as something to try, but it didn’t help in my case.
Sorry to steal your thread, but where do I do that? I would assume that because I have generated the private and public FCM keys I would be good to go? Don’t see a place to enable or disable it in settings.
I have exactly the same problem. I am new to Home Assistant. I’ve setup push notifications this morning with the vapid settings. I’ve received push notifications on my Android phone. After a reboot of HASS.IO it suddenly stopped working. I don’t know how to solve this.
Sat Apr 13 2019 15:53:33 GMT+0200 (CEST)
Push failed: <Response [403]>:
Error 403 (Forbidden)!!1
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
403. That’s an error.
That’s all we know.
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py", line 122, in handle_call_service
connection.context(msg))
File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1138, in async_call
self._execute_service(handler, service_call))
File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1160, in _execute_service
await handler.func(service_call)
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/notify/__init__.py", line 117, in async_notify_message
await notify_service.async_send_message(**kwargs)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/html5/notify.py", line 467, in send_message
self._push_message(payload, **kwargs)
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/html5/notify.py", line 504, in _push_message
vapid_claims=self._vapid_claims
File "/usr/local/lib/python3.7/site-packages/pywebpush/__init__.py", line 384, in webpush
result, result.text))
That’s the same message I’m getting. It doesn’t seem to be callback related or because of nginx as I an able to call manually and I get 405 method not found instead of 403.
It seems like it’s an error from Google and not the callback.
edit: I’ve switched back to gcm and everything is working again. It’s definitely a problem with fcm.
With VAPID you no longer need to sign up for an account with GCM to use push in Chrome and you can use the same code path for subscribing a user and sending a message to a user in both Chrome and Firefox. Both are following the standards.
What you need to bear in mind is that in Chrome 51 and before, Opera for Android and Samsung browser you’ll still need to define the gcm_sender_id in your web app manifest and you’ll need to add the Authorization header to the FCM endpoint that will be returned.
VAPID provides an off ramp from these proprietary requirements. If you implement VAPID it’ll work in all browsers that support web push. As more browsers support VAPID you can decide when to drop the gcm_sender_id from your manifest.
Hello everyone, I’m very new to this, I’m with hassio 0.91.3, I recently installed the nginx addon but now I have problems with html5 notifications (sometimes it notifies, sometimes not), reading the documentation I see that you have to add a new one rule to solve it, but I have no idea where to add the code:
location /api/notify.html5/callback {
if ($ http_authorization = “”) {return 403; }
allow all;
proxy_pass http: // localhost: 8123;
proxy_set_header Host $ host;
proxy_redirect http: // https: //;
}
someone who can help me? a greeting and thanks
I’m not entirely familiar with the nginx hassio add-on because I run it in it’s own container. I put the rule in the default.conf file inside of the server section:
I’m having the same issues, suddenly the html5 notify service stops working. I played with it last weekend and got it working again, but now it’s off again. Didn’t really do anything special to fix it either, so this vapid seems unreliably integrated into HA…
Also the nginx stuff is only relevant if you have a htpasswd/http basic passwd setup on your Reverse Proxy. ie. You are using nginx to auth as well as HASS Auth, etc. It is not relevant to the OP issue (IMO). I have ensured that this is true because my nginx logs have no requests from google apis when I get the error in HASS.
I am finding when I restart HASS it works for a few notifications and then after a while it stops working:
2019-04-30 20:01:35 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall notify.html5_push (c:59aaf0c2ea15456692a2a481c24066b0): target=['phone_browser', 'laptop_browser'], message=<homeassistant.helpers.template.Template object at 0x56eacf30>, title=<homeassistant.helpers.template.Template object at 0x56eac630>>
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1147, in _safe_execute
await self._execute_service(handler, service_call)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1160, in _execute_service
await handler.func(service_call)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/notify/__init__.py", line 112, in async_notify_message
await notify_service.async_send_message(**kwargs)
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/html5/notify.py", line 458, in send_message
self._push_message(payload, **kwargs)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/html5/notify.py", line 495, in _push_message
vapid_claims=self._vapid_claims
File "/srv/homeassistant/lib/python3.5/site-packages/pywebpush/__init__.py", line 428, in webpush
response=response)
pywebpush.WebPushException: WebPushException: Push failed: 403 Forbidden
To me it looks like it is not authenticating to Google properly on send.
With the domain verified, go to https://console.firebase.google.com, select import Google project and select the project you created.
Then, click the cogwheel on top left and select “Project settings”.
Select ‘Cloud Messaging’ tab.
Generate a new key pair under the Web configuration listing at the bottom of the page. To view the private key click the three dots to the right and ‘Show private key’.
from the notification docs, I created a new key pair… and they work. I will see if they continue to work over the next few days.