Hi,
We run parse-server via express in a very similar way to what the README says. So our app only depends on express (4.18.2) and parse-server (6.3.1). It’s running on Heroku (heroku-22).
We tried upgrading from node 16.18.1 to node 18.12.1, but get an error when we try to send a push notification:
verbose: _PushStatus H0Dmigt9ae: sending push to installations with 1 batches
verbose: Sending push to 72
verb parse-server-push-adapter GCM sending to 70 devices
/app/node_modules/parse-server/lib/ParseServer.js:263
throw err;
^Error: unsupported
at configSecureContext (node:internal/tls/secure-context:277:15)
at Object.createSecureContext (node:_tls_common:117:3)
at Object.connect (node:_tls_wrap:1629:48)
at Object.connect (node:internal/http2/core:3287:22)
at /app/node_modules/@parse/node-apn/lib/client.js:121:45
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)Node.js v18.12.1
Process exited with status 7
State changed from up to crashed
Any pointers?
It’s clearly to do with TLS, but if anyone has further insight that would be helpful.
Our config around certs is as follows:
push: {
ios: [
{
pfx: process.env.PUSH_IOS_SANDBOX_PFX || '', // The filename of private key and certificate in PFX or PKCS12 format from disk
passphrase: process.env.PUSH_IOS_SANDBOX_PWD || '', // p12 password
topic: process.env.PUSH_IOS_SANDBOX_BUNDLE_ID || '', // The bundle identifier associated with your app
production: false // Specifies which environment to connect to: Sandbox
},
{
pfx: process.env.PUSH_IOS_PRODUCTION_PFX || '', // The filename of private key and certificate in PFX or PKCS12 format from disk
passphrase: process.env.PUSH_IOS_PRODUCTION_PWD || '', // p12 password
topic: process.env.PUSH_IOS_PRODUCTION_BUNDLE_ID || '', // The bundle identifier associated with your app
production: true // Specifies which environment to connect to: Production
}
],
android: {
apiKey: process.env.PUSH_ANDROID_API_KEY || ''
}
}
Where PUSH_IOS_SANDBOX_PFX
etc are paths like files/Production/Sandbox.p12
, and we have those files in our app.
These are our instructions for generating those files:
-
Go to the Apple Developer “Identifiers” list
-
Click the relevant app
-
Click “Edit” next to “Push Notifications”.
-
Under “Production SSL Certificate”, click “Create Certificate”.
-
You’ll now need to provide a “certificate signing request” (CSR) via Keychain Access
- Open “Keychain Access.app” in macOS
- In the menus:
Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority…
- As email, enter your work email
- As name, enter e.g. “Auctionet Staging Push Certificate” (the name doesn’t really matter)
- Leave the “CA Email Address” field empty (it will no longer be required when we pick “Save to disk” in the next step)
- Choose “Saved to disk”, and click Continue
- Save it to disk, e.g. your desktop
-
On the Apple Developer website, in the “Create a New Certificate” wizard, under the “Upload a Certificate Signing Request” header, provide the
CertificateSigningRequest.certSigningRequest
file you just saved. -
When you’re through the wizard, you’ll get a
.cer
file. Double-click it to open it in Keychain Access. -
Find the certificate in Keychain Access under “My Certificates” in the sidebar. It will be named e.g. “Apple Push Services: com.myapp” and will expire about a year from now.
-
Right-click the certificate and choose “Export …”.
-
When it asks, provide the same password as we have configured on Heroku. Find it like this:
heroku config -a someapp | grep PWD
That’s it! Now we’ve got a cert.
Download it and copy it to e.g. files/Staging/Production.p12
Phew! That was a lot, but I wanted to provide relevant details.