apn icon indicating copy to clipboard operation
apn copied to clipboard

Laravel 7.3 - PHP 7.2 - APN 2.3 - Not working

Open kniyer007 opened this issue 3 years ago • 10 comments

I have a AWS EC2 instance running a Laravel 7.3 application with Laravel notification APN channel (2.3). Up until two weeks back the push notifications were working just fine. But now it is not working. I'm not getting any errors and the push notification requests are processed from the server but push notifications are not getting delivered. Can anyone guide me what could be the reason?

FYI: I haven't made any server side or code level changes within the last two weeks.

kniyer007 avatar Feb 09 '21 17:02 kniyer007

I'm not sure if it's related, but I suddenly started getting errors in production 7 days ago. Occurs in vendor/edamov/pushok/src/Client.php:161. Made no changes to the server, and no changes to any related code.

SSL certificate problem: unable to get local issuer certificate

Laravel 8.2.1 PHP 7.4.3


Not sure if it's worth noting - my server is on AWS EC2 as well (provisioned by Forge).

dwightwatson avatar Feb 09 '21 23:02 dwightwatson

It is related and I had the same issue when I manually updated the package to the latest version. And then based on pushok issue thread I found this: https://github.com/edamov/pushok/issues/121#issuecomment-763537771 And I did that to make the push notifications to work.

But I would like to find out the exact reason and how to fix it in a right way rather than hacking it.

kniyer007 avatar Feb 10 '21 10:02 kniyer007

I had the same problem -> No notifications on production (local was doing fine), so I upgraded to the lastest version of apn (3.2). Now i see the error:

SSL certificate problem: unable to get local issuer certificate

I use LetsEncrypt SSL, I am wondering if something changed regarding that.

ArjenNZ avatar Feb 12 '21 13:02 ArjenNZ

I have had issues with this recently and I have resolved it by updating the trusted certificate in linux. It seems that the required trusted cert which is needed to verify secure connections between server and push notification service has been removed. The removal of this certificate was due to a linux unattended upgrade and putting the cert back in place has resolved the issue immediately.

Running this on the server should replace the certificate:

wget --no-check-certificate -c https://www.geotrust.com/resources/root_certificates/certificates/GeoTrust_Global_CA.pem   \
    && mkdir /usr/local/share/ca-certificates/extra                                                                       \
    && mv GeoTrust_Global_CA.pem /usr/local/share/ca-certificates/extra/GeoTrust_Global_CA.crt                            \
    && update-ca-certificates

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=962596 for the reported bug.

@kniyer007 This solution is much better than disabling the ssl verification. Disabling it would be insecure. @ArjenNZ It worked locally for me also, i suspect you will have the required certificate in place.

andrew-bibby avatar Feb 24 '21 13:02 andrew-bibby

I am experiencing same problem. No Push Notifications got fired from production. Getting following error in laravel.log:

SSL certificate problem: unable to get local issuer certificate {"exception":"[object] (Exception(code: 0): SSL certificate problem: unable to get local issuer certificate at /home/forge/my-app/vendor/edamov/pushok/src/Client.php:161) [stacktrace] #0 /home/forge/my-app/vendor/laravel-notification-channels/apn/src/ApnChannel.php(79): Pushok\Client->push() #1 /home/forge/my-app/vendor/laravel-notification-channels/apn/src/ApnChannel.php(58): NotificationChannels\Apn\ApnChannel->sendNotifications(Object(Pushok\Client), Object(NotificationChannels\Apn\ApnMessage), Array) #2 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php(148): NotificationChannels\Apn\ApnChannel->send(Object(App\Models\User), Object(App\Notifications\PushNotification)) #3 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php(106): Illuminate\Notifications\NotificationSender->sendToNotifiable(Object(App\Models\User), '380b6111-d0ad-4...', Object(App\Notifications\PushNotification), 'NotificationCha...') #4 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php(19): Illuminate\Notifications\NotificationSender->Illuminate\Notifications\{closure}() #5 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php(109): Illuminate\Notifications\NotificationSender->withLocale(NULL, Object(Closure)) #6 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php(54): Illuminate\Notifications\NotificationSender->sendNow(Object(Illuminate\Database\Eloquent\Collection), Object(App\Notifications\PushNotification), Array) #7 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php(104): Illuminate\Notifications\ChannelManager->sendNow(Object(Illuminate\Database\Eloquent\Collection), Object(App\Notifications\PushNotification), Array) #8 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Notifications\SendQueuedNotifications->handle(Object(Illuminate\Notifications\ChannelManager)) #9 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #10 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure)) #11 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #12 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #13 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call(Array) #14 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Illuminate\Notifications\SendQueuedNotifications)) #15 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Notifications\SendQueuedNotifications)) #16 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #17 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(118): Illuminate\Bus\Dispatcher->dispatchNow(Object(Illuminate\Notifications\SendQueuedNotifications), false) #18 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}(Object(Illuminate\Notifications\SendQueuedNotifications)) #19 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Notifications\SendQueuedNotifications)) #20 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #21 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\Queue\Jobs\RedisJob), Object(Illuminate\Notifications\SendQueuedNotifications)) #22 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\RedisJob), Array) #23 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(406): Illuminate\Queue\Jobs\Job->fire() #24 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(356): Illuminate\Queue\Worker->process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Illuminate\Queue\WorkerOptions)) #25 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(307): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Illuminate\Queue\WorkerOptions)) #26 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(116): Illuminate\Queue\Worker->runNextJob('redis', 'default', Object(Illuminate\Queue\WorkerOptions)) #27 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(100): Illuminate\Queue\Console\WorkCommand->runWorker('redis', 'default') #28 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle() #29 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #30 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure)) #31 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #32 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #33 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array) #34 /home/forge/my-app/vendor/symfony/console/Command/Command.php(256): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #35 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #36 /home/forge/my-app/vendor/symfony/console/Application.php(971): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #37 /home/forge/my-app/vendor/symfony/console/Application.php(290): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #38 /home/forge/my-app/vendor/symfony/console/Application.php(166): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #39 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #40 /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #41 /home/forge/my-app/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #42 {main}

fahad-larasoft avatar Feb 25 '21 08:02 fahad-larasoft

I have Laravel 8.0 and APN 3.3

I have no errors but pushes not sended.

In Pushok client $responseCollection is empty after pushes send.

====================

up: my curl was builded without HTTP/2, in that case no errors shown.

KoIIIeY avatar Mar 09 '21 09:03 KoIIIeY

wget --no-check-certificate -c https://www.geotrust.com/resources/root_certificates/certificates/GeoTrust_Global_CA.pem
&& mkdir /usr/local/share/ca-certificates/extra
&& mv GeoTrust_Global_CA.pem /usr/local/share/ca-certificates/extra/GeoTrust_Global_CA.crt
&& update-ca-certificates

Sir i tried updating but it sayd the resource was not found at that geotrust url do u have working certificate?

sarveshamrit avatar May 19 '21 09:05 sarveshamrit

@sarveshamrit

Try this GeoTrust_Global_CA.pem

-----BEGIN CERTIFICATE-----
MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG
EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg
R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9
9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq
fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv
iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU
1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+
bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW
MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA
ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l
uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn
Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS
tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF
PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un
hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV
5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw==
-----END CERTIFICATE-----

andrew-bibby avatar May 19 '21 12:05 andrew-bibby

@andrew-bibby sir i am using https://github.com/davibennun/laravel-push-notification/ but push notification doesn't go to ios device any more i even installed the certificate you provided but it didn't sent push

sarveshamrit avatar May 19 '21 13:05 sarveshamrit

@andrew-bibby sir i am using https://github.com/davibennun/laravel-push-notification/ but push notification doesn't go to ios device any more i even installed the certificate you provided but it didn't sent push

you use 6 years old package that uses different APNS type. This package uses new Apple APNs HTTP/2 connection and of course it's working absolutly different

KoIIIeY avatar May 19 '21 13:05 KoIIIeY