Fixed ErrorException: No GCM API Key specified

Dnyan

Well-known member
I was sending the alerts to my users and all of sudden the error pop up

Code:
ErrorException: No GCM API Key specified.   src/vendor/minishlink/web-push/src/WebPush.php:262

now I am always having which is popping up in ACP after few minutes, There are manual rebuild jobs awaiting completion. Continue running them. running them will create same error again.

Can anyone help me in figuring out why this is happening and what I should do.

I was on PHP 7.4.11 after this issue upgraded to 7.4.12 but no change in behavior were observed.

Code:
Stack trace
#0 src/vendor/minishlink/web-push/src/WebPush.php(168): Minishlink\WebPush\WebPush->prepare()
#1 src/XF/Service/PushNotification.php(198): Minishlink\WebPush\WebPush->flush()
#2 src/XF/Service/PushNotification.php(168): XF\Service\PushNotification->handleResults()
#3 src/XF/Service/PusherTrait.php(182): XF\Service\PushNotification->sendNotifications()
#4 src/XF/Repository/UserAlert.php(163): XF\Service\Alert\Pusher->push()
#5 src/XF/Repository/UserAlert.php(114): XF\Repository\UserAlert->insertAlert()
#6 src/XF/Job/UserAlert.php(45): XF\Repository\UserAlert->alert()
#7 src/XF/Job/AbstractUserCriteriaJob.php(59): XF\Job\UserAlert->executeAction()
#8 src/XF/Job/Manager.php(258): XF\Job\AbstractUserCriteriaJob->run()
#9 src/XF/Job/Manager.php(200): XF\Job\Manager->runJobInternal()
#10 src/XF/Job/Manager.php(84): XF\Job\Manager->runJobEntry()
#11 src/XF/Admin/Controller/Tools.php(139): XF\Job\Manager->runQueue()
#12 src/XF/Mvc/Dispatcher.php(350): XF\Admin\Controller\Tools->actionRunJob()
#13 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass()
#14 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch()
#15 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop()
#16 src/XF/App.php(2300): XF\Mvc\Dispatcher->run()
#17 src/XF.php(465): XF\App->run()
#18 admin.php(13): XF::runApp()
#19 {main}
 
The issue is coming from an add-on, the stack trace suggests the add-on ID is Minishlink/WebPush, and it looks like you're just missing your API key in the options.
 
The API is part of the core system for push notifications, but as far as I know, we never use GCM (we use VAPID keys). Indeed, as far as I know, GCM has been deprecated and shut down.

Did you have any sort of add-on in the past that might've handled something with push notifications?

I think you'd need to manually remove the record from xf_user_push_subscription where the endpoint starts with https://android.googleapis.com/gcm/send as that appears to be how the library detects that GCM is in use.

I'm going to move this to bugs as I think it's worth us trying to catch this.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.2).

Change log:
Prevent an error caused by GCM push notification subscriptions.
There may be a delay before changes are rolled out to the XenForo Community.
 
Top Bottom