Fixed ErrorException: Push notification failure

rdn

Well-known member
PHP:
Server error log
ErrorException: Push notification failure: {"success":false,"endpoint":{},"message":"Client error: `POST https:\/\/uccm-intl.ucweb.com\/wpush\/m\/XzghNt3DHYGktAvAwr2EKEs4ezu1AQwLzTdbVrOe6f6BYwblgRzmfFfMB0o6T-Upwsa2W75G0AdTPfvvDfSj0kbET6zWbA_JX7gYVR-dHWzo7Y58E_FoCatVSM5_J-iq` resulted in a `413 Request Entity Too Large` response:\n{\"errno\":104,\"message\":\"Data payload too large, limit is 2048 bytes, current is 3070 bytes\",\"code\":413}\n","statusCode":413,"reasonPhrase":"Request Entity Too Large","expired":false,"content":{},"headers":{"Date":["Sun, 23 Dec 2018 08:55:52 GMT"],"Content-Type":["application\/json"],"Transfer-Encoding":["chunked"],"Connection":["keep-alive"]}} src/XF/Error.php:75

Generated by: UserName Dec 23, 2018 at 4:55 PM

Stack trace
#0 src/XF.php(189): XF\Error->logError('Push notificati...', false)
#1 src/XF/Service/PushNotification.php(228): XF::logError('Push notificati...')
#2 src/XF/Service/PushNotification.php(178): XF\Service\PushNotification->handleResults(Array, Array)
#3 src/XF/Service/PusherTrait.php(64): XF\Service\PushNotification->sendNotifications()
#4 src/XF/Repository/UserAlert.php(147): XF\Service\Alert\Pusher->push()
#5 src/XF/Repository/UserAlert.php(111): XF\Repository\UserAlert->insertAlert(246, 113, 'UserName', 'profile_post_co...', 38, 'your_profile', Array)
#6 src/XF/Service/ProfilePostComment/Notifier.php(153): XF\Repository\UserAlert->alert(Object(Datio\AllowedEmails\XF\Entity\User), 113, 'UserName', 'profile_post_co...', 38, 'your_profile')
#7 src/XF/Service/ProfilePostComment/Notifier.php(78): XF\Service\ProfilePostComment\Notifier->sendNotification(Object(Datio\AllowedEmails\XF\Entity\User), 'your_profile')
#8 src/XF/Service/ProfilePostComment/Creator.php(123): XF\Service\ProfilePostComment\Notifier->notify()
#9 src/XF/Pub/Controller/ProfilePost.php(233): XF\Service\ProfilePostComment\Creator->sendNotifications()
#10 src/XF/Pub/Controller/ProfilePost.php(256): XF\Pub\Controller\ProfilePost->finalizeProfilePostComment(Object(XF\Service\ProfilePostComment\Creator))
#11 src/XF/Mvc/Dispatcher.php(321): XF\Pub\Controller\ProfilePost->actionAddComment(Object(XF\Mvc\ParameterBag))
#12 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:ProfilePost', 'AddComment', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\ProfilePost), NULL)
#13 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\ProfilePost), NULL)
#14 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#15 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#16 src/XF.php(392): XF\App->run()
#17 index.php(20): XF::runApp('XF\\Pub\\App')
#18 {main}

Request state
array(4) {
  ["url"] => string(29) "/profile-posts/49/add-comment"
  ["referrer"] => string(31) "https://domain.com/whats-new/"
  ["_GET"] => array(1) {
    ["/profile-posts/49/add-comment"] => string(0) ""
  }
  ["_POST"] => array(7) {
    ["message_html"] => string(78) "<p><strong><span style="color: rgb(147, 101, 184);">hello!</span></strong></p>"
    ["last_date"] => string(0) ""
    ["last_known_date"] => string(1) "0"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(11) "/whats-new/"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}

Or an issue with https://xenforo.com/community/resources/allowedemails.6021/ ?
 
I will move this to bugs for now for further investigation, but I think this is the UC browser web push endpoint violating the spec.

This is defined here: https://tools.ietf.org/html/draft-ietf-webpush-protocol-10#section-7.2
Push services might need to limit the size and number of stored push
messages to avoid overloading. To limit the size of messages, the
push service MAY return a 413 (Payload Too Large) status code
[RFC7231] in response to requests that include an entity body that is
too large. Push services MUST NOT return a 413 status code in
responses to an entity body that is 4096 bytes or less in size.
The last sentence is key. We are within the 4096 byte limit -- they've just limited to half of what the spec requires as the minimum.

Assuming that is still the expected case, then I doubt we will change anything.
 
We actually might be able to do something here. Mozilla violates the spec too.

The push library we use has an automatic padding feature (to further obfuscate the encrypted payload data) and we switch this off for Mozilla endpoints for a similar reason so we can likely just do the same here.
 
More error log.

PHP:
Server error log
ErrorException: Push notification failure: {"success":false,"endpoint":{},"message":"Client error: `POST https:\/\/uccm-intl.ucweb.com\/wpush\/m\/h1aB1EI07ZJqAZmWzxI41YoDg8TtZHqT3fgfqhekZq07r3xKjhnsD4kVFbsUXcqG5wskHELAJZLvday48ak5eSNLi2t8jc26fxe4Feq90AJiBruXOT9YJzyaT-ZXQEsy` resulted in a `413 Request Entity Too Large` response:\n{\"errno\":104,\"message\":\"Data payload too large, limit is 2048 bytes, current is 3070 bytes\",\"code\":413}\n","statusCode":413,"reasonPhrase":"Request Entity Too Large","expired":false,"content":{},"headers":{"Date":["Tue, 25 Dec 2018 11:21:34 GMT"],"Content-Type":["application\/json"],"Transfer-Encoding":["chunked"],"Connection":["keep-alive"]}} src/XF/Error.php:75
Generated by: User Dec 25, 2018 at 7:21 PM
Stack trace
#0 src/XF.php(189): XF\Error->logError('Push notificati...', false)
#1 src/XF/Service/PushNotification.php(228): XF::logError('Push notificati...')
#2 src/XF/Service/PushNotification.php(178): XF\Service\PushNotification->handleResults(Array, Array)
#3 src/XF/Service/PusherTrait.php(64): XF\Service\PushNotification->sendNotifications()
#4 src/XF/Repository/UserAlert.php(147): XF\Service\Alert\Pusher->push()
#5 src/XF/Repository/UserAlert.php(111): XF\Repository\UserAlert->insertAlert(310, 363, 'User', 'post', 2337, 'insert', Array)
#6 src/XF/Notifier/AbstractNotifier.php(55): XF\Repository\UserAlert->alert(Object(Datio\AllowedEmails\XF\Entity\User), 363, 'User', 'post', 2337, 'insert', Array)
#7 src/XF/Notifier/Post/AbstractWatch.php(104): XF\Notifier\AbstractNotifier->basicAlert(Object(Datio\AllowedEmails\XF\Entity\User), 363, 'User', 'post', 2337, 'insert')
#8 src/XF/Service/AbstractNotifier.php(86): XF\Notifier\Post\AbstractWatch->sendAlert(Object(Datio\AllowedEmails\XF\Entity\User))
#9 src/XF/Service/AbstractNotifier.php(44): XF\Service\AbstractNotifier->notifyType(Object(XF\Notifier\Post\ThreadWatch), Array, G)
#10 src/XF/Service/AbstractNotifier.php(56): XF\Service\AbstractNotifier->notify(3)
#11 src/XF/Service/Thread/Replier.php(205): XF\Service\AbstractNotifier->notifyAndEnqueue(3)
#12 src/XF/Pub/Controller/Thread.php(330): XF\Service\Thread\Replier->sendNotifications()
#13 src/XF/Pub/Controller/Thread.php(463): XF\Pub\Controller\Thread->finalizeThreadReply(Object(XF\Service\Thread\Replier))
#14 src/addons/Snog/ForceSecure/XF/Pub/Controller/Thread.php(14): XF\Pub\Controller\Thread->actionAddReply(Object(XF\Mvc\ParameterBag))
#15 src/XF/Mvc/Dispatcher.php(321): Snog\ForceSecure\XF\Pub\Controller\Thread->actionAddReply(Object(XF\Mvc\ParameterBag))
#16 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:Thread', 'AddReply', Object(XF\Mvc\RouteMatch), Object(Snog\ForceSecure\XF\Pub\Controller\Thread), NULL)
#17 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Snog\ForceSecure\XF\Pub\Controller\Thread), NULL)
#18 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#19 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#20 src/XF.php(392): XF\App->run()
#21 index.php(20): XF::runApp('XF\\Pub\\App')
#22 {main}
Request state
array(4) {
  ["url"] => string(21) "/threads/41/add-reply"
  ["referrer"] => string(32) "https://domain.com/threads/41/"
  ["_GET"] => array(1) {
    ["/threads/41/add-reply"] => string(0) ""
  }
  ["_POST"] => array(9) {
    ["message_html"] => string(27) "<p>Thank you sir!&nbsp;</p>"
    ["attachment_hash"] => string(32) "efc837e74ceebd087b0eef23572d406d"
    ["attachment_hash_combined"] => string(84) "{"type":"post","context":{"thread_id":41},"hash":"efc837e74ceebd087b0eef23572d406d"}"
    ["last_date"] => string(10) "1545446530"
    ["last_known_date"] => string(10) "1545709194"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(12) "/threads/41/"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}

Server error log
ErrorException: Push notification failure: {"success":false,"endpoint":{},"message":"Client error: `POST https:\/\/uccm-intl.ucweb.com\/wpush\/m\/h1aB1EI07ZJqAZmWzxI41YoDg8TtZHqT3fgfqhekZq07r3xKjhnsD4kVFbsUXcqG5wskHELAJZLvday48ak5eSNLi2t8jc26fxe4Feq90AJiBruXOT9YJzyaT-ZXQEsy` resulted in a `413 Request Entity Too Large` response:\n{\"errno\":104,\"message\":\"Data payload too large, limit is 2048 bytes, current is 3070 bytes\",\"code\":413}\n","statusCode":413,"reasonPhrase":"Request Entity Too Large","expired":false,"content":{},"headers":{"Date":["Tue, 25 Dec 2018 04:40:06 GMT"],"Content-Type":["application\/json"],"Transfer-Encoding":["chunked"],"Connection":["keep-alive"]}} src/XF/Error.php:75
Generated by: Unknown account Dec 25, 2018 at 12:40 PM
Stack trace
#0 src/XF.php(189): XF\Error->logError('Push notificati...', false)
#1 src/XF/Service/PushNotification.php(228): XF::logError('Push notificati...')
#2 src/XF/Service/PushNotification.php(178): XF\Service\PushNotification->handleResults(Array, Array)
#3 src/XF/Service/PusherTrait.php(64): XF\Service\PushNotification->sendNotifications()
#4 src/XF/Repository/UserAlert.php(147): XF\Service\Alert\Pusher->push()
#5 src/XF/Repository/UserAlert.php(98): XF\Repository\UserAlert->insertAlert(310, 310, 'User', 'trophy', 1, 'award', Array)
#6 src/XF/Repository/Trophy.php(91): XF\Repository\UserAlert->alertFromUser(Object(Datio\AllowedEmails\XF\Entity\User), Object(Datio\AllowedEmails\XF\Entity\User), 'trophy', 1, 'award')
#7 src/XF/Repository/Trophy.php(70): XF\Repository\Trophy->awardTrophyToUser(Object(XF\Entity\Trophy), Object(Datio\AllowedEmails\XF\Entity\User))
#8 src/XF/Cron/Trophy.php(38): XF\Repository\Trophy->updateTrophiesForUser(Object(Datio\AllowedEmails\XF\Entity\User), Array, Object(XF\Mvc\Entity\ArrayCollection))
#9 [internal function]: XF\Cron\Trophy::runTrophyCheck(Object(XF\Entity\CronEntry))
#10 src/XF/Job/Cron.php(35): call_user_func(Array, Object(XF\Entity\CronEntry))
#11 src/XF/Job/Manager.php(253): XF\Job\Cron->run(G)
#12 src/XF/Job/Manager.php(195): XF\Job\Manager->runJobInternal(Array, G)
#13 src/XF/Job/Manager.php(79): XF\Job\Manager->runJobEntry(Array, G)
#14 job.php(42): XF\Job\Manager->runQueue(false, 8)
#15 {main}
Request state
array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => string(21) "https://domain.com/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.0 B7/RC1).

Change log:
Disable push notification padding for UC browser's endpoint as it appears to the violate the spec and limit the allowed size significantly.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
So when I first upgraded to XF2.1, I was not getting these errors.

I had a slight snafu, had to restore my site from a backup that was made RIGHT before I upgraded to 2.1. So I had to do the upgrade again.

The upgrade completed fine and the site is working. But now I am getting a LOT of these errors related to the push notifications. They look almost exactly like those above.

If needed, I'll be happy to upload a copy of a few of the errors, but I am hoping there is a known easy fix for this.

Thanks.
 
I recommend creating a new thread in the troubleshooting forum with the full error message and stack trace from the actual errors you’re getting.
 
I recommend creating a new thread in the troubleshooting forum with the full error message and stack trace from the actual errors you’re getting.

Doh! Saw this after I posted here,

 
Back
Top Bottom