Html5 vapid 403 forbidden

I’m having the same problems with the vapid push messages. Generating a new key pair within firebase didn’t help for me unfortunately.

Edit 13:13: Somehow I had to re-enable push messages on my different devices in my profile too. After deleting the old registrations from the “html5_push_registrations.conf” file and registering the new devices, everything works again.

Yeah, so for me they stopped working again… It worked for a few test messages and normal automation messages but after a few… I have no idea if there is some event that is killing it but it stops again now.

tomorrow I will make an issue on github.

1 Like

Same here - works for some time and stops without any reason… pywebpush.WebPushException: WebPushException: Push failed: 403 Forbidden

I created an issue, please +1 it if you are having the same issue; https://github.com/home-assistant/home-assistant/issues/23613

Having the same issue as well.

Also, it seems that after a while it causes a new issue (though I assume it’s related):

2019-05-02 02:56:25 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1505592304] Client exceeded max pending messages [2]: 512

Reverting pywebpush to 1.6.0 works for me so far.

To revert the pywebpush version, you can just create a folder called “html5” inside your custom components folder and copy all the files from here https://github.com/home-assistant/home-assistant/tree/dev/homeassistant/components/html5 into this folder

Then modify the “manifest.json” file and change pywebpush==1.9.2 to pywebpush==1.6.0 and restart hass.

6 Likes

thank you for these instructions.

It stopped working for me as well. I’ll do the +1, thanks for making the issue!

yeha, hte reverting of the version works for me also still.

Thanks for posting this fix, this also worked for me! Notifications appeared to work for about 24 hours before getting 403 errors prior to reverting to pywebpush 1.6.0.

This solved form me for about 12h, and after that the problem is the same :confused:

Strange, for me it works for 3 days now without any errors. Can you show your error log? Is it the same error as before?

I’m having the same issue. The bandaid fix above didn’t help either.

Do you get the same error message as before the fix? Can you please show your logs?

Running on Hassio, same issue. The fix above didn’t help either… Other suggestions to get this working again?

Did you receive the same error in the log? Could you please show your logs?

2019-05-06 07:29:54 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1662700912] Push failed: <Response [403]>: 
<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 403 (Forbidden)!!1</title>
  <style>
    *{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}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>403.</b> <ins>That’s an error.</ins>
  <p>  <ins>That’s all we know.</ins>
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/websocket_api/commands.py", line 122, in handle_call_service
    connection.context(msg))
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1138, in async_call
    self._execute_service(handler, service_call))
  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/asyncio/tasks.py", line 241, in _step
    result = coro.throw(exc)
  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 117, 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 384, in webpush
    result, result.text))
pywebpush.WebPushException: Push failed: <Response [403]>: 
<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 403 (Forbidden)!!1</title>
  <style>
    *{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}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>403.</b> <ins>That’s an error.</ins>
  <p>  <ins>That’s all we know.</ins>

I reverted back, only have the logs for the current issue again:

WebPushException: Push failed: 403 Forbidden
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py”, line 121, 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 112, 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 458, in send_message
self._push_message(payload, **kwargs)
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/html5/notify.py”, line 495, in _push_message
vapid_claims=self._vapid_claims
File “/usr/local/lib/python3.7/site-packages/pywebpush/init.py”, line 428, in webpush
response=response)
pywebpush.WebPushException: WebPushException: Push failed: 403 Forbidden

`

Do you have this in your log in the beginning?

2019-05-02 23:02:05 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for html5 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

Just wanna make sure that the custom component was recognized.

Honestly, couldn’t tell you… it didn’t work so I went back to my original config…