Closed markl-vesper closed 2 years ago
Hi @markl-vesper - can you try logging in with a new user? Does that issue still occur?
Hi @abdallahshaban557
Thanks for reaching out. Well today the error is no longer apparent when logging in with any user. What I do notice though is that PushNotification.onRegister is never called so we never get to save the token locally or update our backend and associate with the user on our side.
After reading a few forums I attempted to debug this a bit further using
import { NativeModules } from 'react-native';
NativeModules.RNPushNotification.getToken(
token => console.log('RNPushNotification.getToken: ', token),
err => console.log('RNPushNotification.getToken err: ', err),
);
and
const result = PushNotification.initializeAndroid()
console.log('initializeAndroid result: ', result)
Both fail with
ERROR [ERROR] 49:58.851 Notification - Error getting the token from Firebase Service java.util.concurrent.ExecutionException: java.io.IOException: FIS_AUTH_ERROR
It might be that the dpenedencies need updating perhaps? Some forums suggest this
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.firebase:firebase-messaging:15.0.2"
Hi :wave: @markl-vesper
Trying to get some clarity on where the current issue is. Originally you were talking about Pinpoint endpoint errors when logging in and now you are having a PushNotification error. I see that you are no longer having the Analytics error itself, did the Push Notification error only show up after the other error went away? And is it now safe to assume there is no problems with Analytics and this is now a Push Notifications issue?
One last thing, I see you are experiencing this on Android, have you tried on iOS?
Hi @tannerabread
Yes - Yesterday the errors were occuring during the Analytics.updateEndpoint. Today that error is no longer occuring. The only changes were to restart the environment in terms of node server and device emulator.
Actually the push notification error showed up as part of attempting to triage the original issue prior to opening this case. I was attempting to determine the value of the token and if it was making it as far as being saved on our side and thats when I noticed the token on our side was null and that both geToken and initialiseAndroid are throwing the FIS_AUTH_ERROR
iOS did not appear to have such issues but I will retest on iMAC system today and advise further
One further update re original issue. Its just come back after restarting the app. No other changes were made. Had been in a meeting and came back to desk and sent the above reply and then started app and the original error
[ERROR] 50:36.296 AWSPinpointProvider - updateEndpoint failed [ReferenceError: Property 'err' doesn't exist]
has returned.
Would seem that this is an intermittent issue now
running adb logcat has helped further. Looks like a config file is not being included somehow or API key is incorrect. I'll dig down deeper into this as it should be using the same google.services.json as previous version (older RN versions etc etc) of the app which was working fine
10-19 09:35:59.528 1328 1560 E GCM : Missing checkin config file 10-19 09:35:59.528 1328 1560 W GCM : GCM FAILED TO INITIALIZE - missing checkin 10-19 09:35:59.531 3567 4056 E FirebaseInstanceId: Topic sync or token retrieval failed on hard failure exceptions: AUTHENTICATION_FAILED. Won't retry the operation. 10-19 09:35:59.533 1328 3685 E GCM : Missing checkin config file 10-19 09:35:59.534 1328 3685 W GCM : GCM FAILED TO INITIALIZE - missing checkin 10-19 09:35:59.539 1328 3790 I Fitness : FitCleanupIntentOperation received Intent android.intent.action.PACKAGE_CHANGED [CONTEXT service_id=17 ] 10-19 09:35:59.556 3567 3594 W Bugle : BugleFirebaseInstanceIDManagerImpl: Failed to refresh firebase instance ID 10-19 09:35:59.556 3567 3594 W Bugle : java.io.IOException: AUTHENTICATION_FAILED
10-19 09:39:57.529 7204 7238 W Firebase-Installations: Error when communicating with the Firebase Installations server API. HTTP response: [400 Bad Request: { 10-19 09:39:57.529 7204 7238 W Firebase-Installations: "error": { 10-19 09:39:57.529 7204 7238 W Firebase-Installations: "code": 400, 10-19 09:39:57.529 7204 7238 W Firebase-Installations: "message": "API key expired. Please renew the API key.", 10-19 09:39:57.529 7204 7238 W Firebase-Installations: "status": "INVALID_ARGUMENT", 10-19 09:39:57.529 7204 7238 W Firebase-Installations: "details": [ 10-19 09:39:57.529 7204 7238 W Firebase-Installations: { 10-19 09:39:57.529 7204 7238 W Firebase-Installations: "@type": "type.googleapis.com/google.rpc.ErrorInfo", 10-19 09:39:57.529 7204 7238 W Firebase-Installations: "reason": "API_KEY_INVALID", 10-19 09:39:57.529 7204 7238 W Firebase-Installations: "domain": "googleapis.com", 10-19 09:39:57.529 7204 7238 W Firebase-Installations: "metadata": { 10-19 09:39:57.529 7204 7238 W Firebase-Installations: "service": "firebaseinstallations.googleapis.com" 10-19 09:39:57.529 7204 7238 W Firebase-Installations: } 10-19 09:39:57.529 7204 7238 W Firebase-Installations: } 10-19 09:39:57.529 7204 7238 W Firebase-Installations: ] 10-19 09:39:57.529 7204 7238 W Firebase-Installations: } 10-19 09:39:57.529 7204 7238 W Firebase-Installations: } 10-19 09:39:57.529 7204 7238 W Firebase-Installations: ]
@markl-vesper I noticed you are on the latest @aws-amplify/pushnotification
version but not the latest aws-amplify
version. This is sometimes known to cause issues with the config.
Can you try updating aws-amplify
to 4.3.39?
will do - good point and thanks for pointing out!!
upgrade of aws-amplify did not help but I believe I have found the issue
The logcat is reporting the apikey is invalid. When you download the google-services.com it contains TWO current_key entries in api_key section. These do not match the WebAPI Key in the top section on the console screen
As test I replaced the api key in google-services.json with the key from the screen instead of using the api keys that were downloaded and errors have gone!!
This makes me wonder how on earth our app in the store is working (yet it is) when it is using an old apikey. This app has not needed a rebuild for a long time since we update via codepush so perhaps it might start to fail if we had to rebuild the native side.
For now it looks better. I have not tested an actual PN yet as I need to go to a meeting now
Thanks for the updates. That's really interesting that your app is working with an old apiKey!
I'll leave this open until you have time to test the PN but I do have one more question, are you only running this on an emulated device? If so, was the triaging of the first error the first time you tried to use the PushNotification category at all?
Hi @tannerabread
Have tried PN on both physical device and emulator
I have completed some further debugging since yesterday
Currently the app will only build when compileSdkVersion = 33. Anything below that then the build will fail due to some android libraries complaining about requiring 33 (I can provide that output if required)
However when building app against 33 and running a test PN I can see the PN arrive via adb logcat output but we get the the below error
10-20 10:40:24.831 13969 14153 I RNPushNotificationMessagingService: Message From: 123917093506
10-20 10:40:24.836 13969 13969 I emit : notification emit
10-20 10:40:24.837 13969 13969 I RNPushNotificationMessagingService: sendNotification: Bundle[{pinpoint.openApp=true, userInteraction=false, pinpoint.notification.sound=default, pinpoint.notification.title=Cortex Alarm, pinpoint.notification.body=Vessel position is outside of its alarm zone, id=-939047208, pinpoint.campaign.campaign_id=_DIRECT, pinpoint.notification.silentPush=0}]
10-20 10:40:24.839 13969 13969 D skia : --- Failed to create image decoder with message 'unimplemented'
10-20 10:40:24.839 13969 13969 I RNPushNotificationHelper: sendNotification: Intent { cmp=com.cortexmonitoring/com.amazonaws.amplify.pushnotification.modules.RNPushNotificationBroadcastReceiver (has extras) }
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: failed to send push notification
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: java.lang.IllegalArgumentException: com.cortexmonitoring: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at com.amazonaws.amplify.pushnotification.modules.RNPushNotificationHelper.sendToNotificationCentre(RNPushNotificationHelper.java:318)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at com.amazonaws.amplify.pushnotification.RNPushNotificationMessagingService.sendNotification(RNPushNotificationMessagingService.java:110)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at com.amazonaws.amplify.pushnotification.RNPushNotificationMessagingService.handleFCMMessagePush(RNPushNotificationMessagingService.java:90)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at com.amazonaws.amplify.pushnotification.RNPushNotificationMessagingService.access$000(RNPushNotificationMessagingService.java:39)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at com.amazonaws.amplify.pushnotification.RNPushNotificationMessagingService$1.run(RNPushNotificationMessagingService.java:65)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at android.os.Handler.handleCallback(Handler.java:938)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at android.os.Handler.dispatchMessage(Handler.java:99)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at android.os.Looper.loopOnce(Looper.java:201)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at android.os.Looper.loop(Looper.java:288)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at android.app.ActivityThread.main(ActivityThread.java:7842)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at java.lang.reflect.Method.invoke(Native Method)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
10-20 10:40:24.841 13969 13969 E RNPushNotificationHelper: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Am now trying to understand this error and looking for possible fixes. In an effort to understand how its ended up with only building for version 33 I have started a brand new hello world project and will get the PN project implemented tested & working 1st before adding other other RN packages to find out which one caused us to try 33 in the 1st place to see if we can avoid it for now
we can probably close this now as this is were I have landed
Hi 👋 @markl-vesper thank you for leaving your debug trail here in case anyone else encounters this same issue.
Closing this as resolved. If anyone else experiences this issue and is in need of assistance, please feel free to comment and provide us with additional information so we can re-open this issue and be better able to assist you.
Thank you!
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Push Notifications
Amplify Categories
notifications
Environment information
Describe the bug
When calling
we are seeing below error
ERROR [ERROR] 46:10.579 AWSPinpointProvider - updateEndpoint failed [ReferenceError: Property 'err' doesn't exist]
Expected behavior
No error should be generated
Reproduction steps
npx react-native run-android
application builds and installs onto emulator then runs and error is generated as user is logging into app
Code Snippet
Log output
aws-exports.js
Manual configuration
No response
Additional configuration
No response
Mobile Device
Android Pixel 4XL
Mobile Operating System
Android 12
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
Pinpoint Analytics is working fine so its not a credentials issue. For some reason it would appear the updateEndpoint is throwing the error