Problem
I have searched extensively trying to resolve this issue of trying to run push notifications from laravel, using https://github.com/laravel-notification-channels/apn.
Here is my configuration for the apns within broadcasting.php:
apn => [
'environment' => \NotificationChannels\Apn\ApnChannel::SANDBOX, // Or ApnChannel::SANDBOX
'certificate' => base_path('ApnsDev.pem'),
'pass_phrase' => 'MY_PASSWORD', // Optional passPhrase
],
Here is the error I keep continously getting from the bash:
NotificationChannels\Apn\Exceptions\ConnectionFailed : Cannot connect to APNs: Unable to connect: tls://gateway.sandbox.push.apple.com:2195: 2 (stream_socket_client(): Unable to set local cert chain file `C:\Users\Dell\la ravel-backend\aps_development.cer'; Check that your cafile/capath settings include details of your certificate and its issuer)
at C:\Users\Dell\laravel-backend\vendor\laravel-notification-channels\apn\src\Exceptions\ConnectionFailed.php:16 12| * @return \NotificationChannels\Apn\Exceptions\ConnectionFailed 13| */ 14| public static function create($exception) 15| {
16| return new static("Cannot connect to APNs: {$exception->getMessage()}", 0, $exception); 17| } 18| } 19|
Exception trace:
1
NotificationChannels\Apn\Exceptions\ConnectionFailed::create(Object(ZendService\Apple\Exception\RuntimeException)) C:\Users\Dell\laravel-backend\vendor\laravel-notification-channels\apn\src\InteractsWithConnection.php:322 ZendService\Apple\Exception\RuntimeException::("Unable to connect: tls://gateway.sandbox.push.apple.com:2195: 2 (stream_socket_client(): Unable to set local cert chain file `C:\Users\Dell\laravel-backend\aps_development .cer'; Check that your cafile/capath settings include details of your certificate and its issuer)") C:\Users\Dell\laravel-backend\vendor\zendframework\zendservice-apple-apns\src\Apns\Client\AbstractClient.php:113
Please use the argument -v to see more details.
Please help! We are so close on getting our app out but just need to be able to send push notifications, we are able to generate device tokens from the ionic cordova frontend but without the laravel backend being able to send the notification then we're kind of in a rut then.