Description
Hey, we have a custom app that has a chat option powered by the RocketChat. While on Android we do receive a silent push notification via FCM, when we send the push notification on IOS devices, we get the following error:
Push ➔ debug Could not send notification id: “undefined”, Error: Cannot read property ‘send’ of undefined
Push ➔ debug TypeError: Cannot read property ‘send’ of undefined at sendAPN (app/push/server/apn.js:48:16) at PushClass.sendNotificationNative (app/push/server/push.js:87:5) at app/push/server/push.js:208:16 at SynchronousCursor.forEach (packages/mongo/mongo_driver.js:1141:16) at Cursor. [as forEach] (packages/mongo/mongo_driver.js:920:44) at PushClass.sendNotification (app/push/server/push.js:201:35) at PushClass.send (app/push/server/push.js:325:9) at PushNotification.send (app/push-notifications/server/lib/PushNotification.js:70:15) at NotificationClass.push (app/notification-queue/server/NotificationQueue.ts:102:20) at app/notification-queue/server/NotificationQueue.ts:74:12 at /snap/rocketchat-server/1491/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
Server Setup Information
- Version of Rocket.Chat Server: 3.18.3
- Operating System:
- Deployment Method:
- Number of Running Instances:
- DB Replicaset Oplog:
- NodeJS Version: v12.22.1
- MongoDB Version: 3.6.14 / wiredTiger (oplog Enabled)
- Proxy:
- Firewalls involved:
Had same issue on 4.8.7
Private key and/or format how it was pasted into config was wrong.
Exporting apple push certificate from .p12
openssl pkcs12 -in cert.p12 -out newfile.crt.pem -clcerts -nokeys
openssl pkcs12 -in cert.p12 -out newfile.key.pem -nocerts -nodes
Then putting the full output into Push configuration,
Format like
Bag Attributes
friendlyName: something
localKeyID: 7D EE 03 27 E2 00 7D 88 BC 01 BE 75 C5 00 B7 59 00 7E 2A 64
Key Attributes:
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC4iL3yU/lfBGLE
Rg+56Ce4Oko4Ak/5lQ5SlM7rGEo3wT/DpY2L25NXXXeynYpi1raovLKaTiqo/KmI
54V882TAN03uI8LL2u41Y+DLyOsoZEzJqCOwfagoxqZiDg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xeTKPq51lUeUroVaXfTamjXeBmxAoGBAMa1
dXgmNtMY3R78N0EvmWOai6+//xnzbEftJVyfHCGOg7jpI58t9RtYU9fTNiD14BbF
bGhmX8xrwWP7Cw63k5Nu1kFKkr9e2zB1oFbO7VoZx/5krxq7YlYhstXbhsY78Zfo
QyHRlA74V2FbuI3v18YKgHnjxwlmS6ZintMWgfiRAoGAKNobDo7Ls40vtFqbqsI3
yn7sDglJThBSCJhpGlzqZD3H+QOioatKbEZLMQv9ZdTMfnOag9NHH0fFNjyfyfCH
kFAVqEpJrsCwF/bpYPgYBj7THzWfpz4stVWseh4sjd8FyEhYZ1wLQ0qkiT7y/tjET1MGK
fzFHDjGapd4ZtS+iUhKm4vg=
-----END PRIVATE KEY-----
Bag Attributes
friendlyName: Apple Push Services: com.something.something
localKeyID: 7D EE 03 27 E2 AD 7D 88 00 00 BE 00 C5 DC B7 59 8F 7E 2A 64
subject=/UID=com.cradon.radonm/CN=Apple Push Services: com.something.random/OU=HV67G3ZRG7/O=Company or something/C=US
issuer=/CN=Apple Worldwide Developer Relations Certification Authority/OU=G4/O=Apple Inc./C=US
-----BEGIN CERTIFICATE-----
MIIG2jCCBcKgAwIBAgIQSnBDOvSyk2uOrEuRBG8vqzANBgkqhkiG9w0BAQsFADB1
MUQwQgYDVQQDDDtBcHBsZSBXb3JsZHdpse4hZGUgRGV2ZWxvcGVyIFJlbGF0aW9ucyBD
ZXJ0aWZpY2F0aW9uIEF1dGhvcml000000AkGA1UECwwCRzQxEzARBgNVBAoMCkFw
cGxlIEluYy4xCzAJBgNVBAYTAlVTMB4XDTIzMDMzMTEwMjIyMloXDTI0MDQyOTEw
MjIyMVowgbQxJzAlBgoJkiaJk/IsZAEBDBdjb20uY29tbGlua2luYy5waWdlb25y
bjE1MDMGA1UEAwwsQXBwbGUgUHVzaCBTZXJ2aWNlczogY29tLmNvbWxpbmtpbmMu
cGlnZW9ucm4xEzARBgNVBAsMCkhWNjdHM1pSRzcxMDAuBgNVBAoMJ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