Pull request #2077 added the feature of using Apple Push Notification Services, but unfortunately it doesn't seem to handle the case where APNS environment variables are not set gracefully. The program should check that the variables are non-empty before passing to node-apn for configuration.
Current Behavior
The program crashes with an error in node-apn.
Steps to Reproduce
Run npm run test:notification without setting the APNS environment variables.
streetmerchant/node_modules/@parse/node-apn/lib/config.js:81
throw new Error("token.keyId is missing");
^
Error: token.keyId is missing
at validateToken (streetmerchant/node_modules/@parse/node-apn/lib/config.js:81:11)
at validateOptions (streetmerchant/node_modules/@parse/node-apn/lib/config.js:71:9)
at config (streetmerchant/node_modules/@parse/node-apn/lib/config.js:34:5)
at new Client (streetmerchant/node_modules/@parse/node-apn/lib/client.js:26:19)
at new Provider (streetmerchant/node_modules/@parse/node-apn/lib/provider.js:12:19)
at Object.sendApns (streetmerchant/build/src/notification/apns.js:36:25)
at Object.sendNotification (streetmerchant/build/src/notification/notification.js:30:12)
at Object.<anonymous> (streetmerchant/build/test/functional/test-notification.js:32:16)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
Expected Behavior
Pull request #2077 added the feature of using Apple Push Notification Services, but unfortunately it doesn't seem to handle the case where APNS environment variables are not set gracefully. The program should check that the variables are non-empty before passing to node-apn for configuration.
Current Behavior
The program crashes with an error in node-apn.
Steps to Reproduce
Run
npm run test:notification
without setting the APNS environment variables.Environment
Logs