Hi,
First time on your forums, so if I’m in the wrong place please let me know.
I’m working on getting AWS Amplify Push Notifications set up in my Expo project. I’ve followed the documentation on AWS and at this expo blog. I’ve been able to send analytics data to the AWS Pinpoint dashboard so I know I’m configured correctly, but whenever I try to use the PushNotification library I get an Unhandled Promise rejection warning.
The research I’ve done is pointing to a build.gradle problem, but I’m not wanting to eject my project if I can help it.
Here are the build dependencies I have set up currently:
“dependencies”: {
“@aws-amplify/pushnotification”: “^1.0.27”,
“aws-amplify”: “^1.1.28”,
“aws-amplify-react-native”: “^2.1.12”,
“aws-sdk”: “^2.457.0”,
“expo”: “^32.0.0”,
“expokit”: “^32.1.2”,
“firebase”: “^6.0.2”,
“fsevents”: “^2.0.6”,
“react”: “^16.5.0”,
“react-native”: “https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz”,
“react-native-push-notification”: “^3.1.3”,
“react-navigation”: “^3.8.1”
}
Here is the error message:
[Unhandled promise rejection: TypeError: undefined is not an object (evaluating ‘RNPushNotification.initialize’)]
- node_modules/@aws-amplify/pushnotification/lib/PushNotification.js:139:43 in
- node_modules/@aws-amplify/pushnotification/lib/PushNotification.js:44:27 in step
- node_modules/@aws-amplify/pushnotification/lib/PushNotification.js:19:13 in
- node_modules/promise/setimmediate/core.js:45:7 in tryCallTwo
- node_modules/promise/setimmediate/core.js:200:23 in doResolve
- node_modules/promise/setimmediate/core.js:66:12 in Promise
- node_modules/@aws-amplify/pushnotification/lib/PushNotification.js:15:36 in
- node_modules/@aws-amplify/pushnotification/lib/PushNotification.js:91:12 in configure
- node_modules/@aws-amplify/core/lib/Amplify.js:25:27 in
- [native code]:null in map
- node_modules/@aws-amplify/core/lib/Amplify.js:24:29 in configure
- App.js:9:18 in
- node_modules/metro/src/lib/polyfills/require.js:292:12 in loadModuleImplementation
- node_modules/expo/AppEntry.js:2:0 in
- node_modules/metro/src/lib/polyfills/require.js:292:12 in loadModuleImplementation
- node_modules/metro/src/lib/polyfills/require.js:179:45 in guardedLoadModule
- null:null in global code
I would try using the Expo Push Notification library, but I have a client requirement to use AWS Pinpoint and AWS Push Notifications.
I’ve been banging my head against the wall on these dependencies for a few days now. Any help would be greatly appreciated.
Thanks