aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.43k stars 2.13k forks source link

[PushNotification] Unable to create service com.amazonaws.amplify.pushnotification.PushNotificationFirebaseMessagingService #12825

Closed enzzoperez closed 9 months ago

enzzoperez commented 10 months ago

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Push Notifications

Amplify Version

v5

Amplify Categories

notifications

Backend

None

Environment information

``` System: OS: macOS 13.6 CPU: (8) arm64 Apple M1 Pro Memory: 74.42 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm Watchman: 2023.08.14.00 - /opt/homebrew/bin/watchman Browsers: Brave Browser: 120.1.61.114 Safari: 16.6 npmPackages: @amplitude/analytics-react-native: ~0.4.7 => 0.4.11 @aws-amplify/rtn-push-notification: ~1.1.7 => 1.1.11 @babel/core: ^7.12.9 => 7.23.7 @babel/runtime: ^7.12.5 => 7.23.8 @bam.tech/react-native-image-resizer: 3.0.4 => 3.0.4 @gorhom/bottom-sheet: ~4 => 4.6.0 @react-native-async-storage/async-storage: ~1.17.9 => 1.17.12 @react-native-clipboard/clipboard: 1.11.1 => 1.11.1 @react-native-community/datetimepicker: ~7.1.0 => 7.1.0 @react-native-community/eslint-config: ^2.0.0 => 2.0.0 @react-native-community/masked-view: ~0.1.11 => 0.1.11 @react-native-community/netinfo: ~9.3.0 => 9.3.11 @react-native-community/push-notification-ios: ~1.11.0 => 1.11.0 @react-navigation/bottom-tabs: ~6.3.2 => 6.3.3 @react-navigation/material-bottom-tabs: ~6.2.2 => 6.2.19 @react-navigation/native: ~6.0.11 => 6.0.16 @react-navigation/native-stack: ~6.7.0 => 6.7.0 @reduxjs/toolkit: ~1.8.3 => 1.8.6 @reduxjs/toolkit-query: 1.0.0 @reduxjs/toolkit-query-react: 1.0.0 @sentry/react-native: 5.0.0-alpha.3 => 5.0.0-alpha.3 @tsconfig/react-native: ^2.0.2 => 2.0.3 @types/jest: ^26.0.23 => 26.0.24 @types/react-native: ^0.69.3 => 0.69.26 (0.70.19) @types/react-native-dotenv: ~0.2.0 => 0.2.2 @types/react-native-vector-icons: ^6.4.11 => 6.4.18 @types/react-redux: ~7.1.24 => 7.1.33 @types/react-test-renderer: ^18.0.0 => 18.0.7 @typescript-eslint/eslint-plugin: ^5.33.0 => 5.62.0 (3.10.1) @typescript-eslint/parser: ^5.33.0 => 5.62.0 (3.10.1) HelloWorld: 0.0.1 amazon-cognito-identity-js: ~5.2.14 => 5.2.14 (6.3.10) amazon-cognito-identity-js/internals: undefined () aws-amplify: ~5.3.11 => 5.3.15 axios: ~0.27.2 => 0.27.2 (1.6.5) babel-jest: ^26.6.3 => 26.6.3 date-fns: ~2.30.0 => 2.30.0 eslint: ^7.32.0 => 7.32.0 eslint-config-airbnb: ^19.0.4 => 19.0.4 eslint-config-airbnb-typescript: ~17.0.0 => 17.0.0 eslint-plugin-import: ^2.26.0 => 2.29.1 eslint-plugin-jsx-a11y: ^6.6.1 => 6.8.0 eslint-plugin-prettier: ^4.2.1 => 4.2.1 (3.1.2) eslint-plugin-react: ^7.30.1 => 7.33.2 eslint-plugin-react-hooks: ^4.6.0 => 4.6.0 hermes-engine: %VERSION% hermes-engine-cli: %VERSION% hermes-eslint: 0.7.0 hermes-estree: 0.7.0 hermes-inspector-msggen: 1.0.0 hermes-parser: 0.7.0 hermes-parser-packages: undefined () hermes-transform: 0.7.0 hermes-website: 0.0.0 husky: ^8.0.1 => 8.0.3 i18next: ~21.9.0 => 21.9.2 jest: ^26.6.3 => 26.6.3 lint-staged: ^13.0.3 => 13.3.0 metro-react-native-babel-preset: ^0.70.3 => 0.70.4 native-base: ~3.4.11 => 3.4.28 prettier: ^2.7.1 => 2.8.8 react: ~18.0.0 => 18.0.0 react-i18next: ~11.18.3 => 11.18.6 react-native: ~0.69.3 => 0.69.12 react-native-autocomplete-dropdown: ~2.0.7 => 2.0.7 react-native-biometrics: ~3.0.1 => 3.0.1 react-native-bootsplash: ~5.0.2 => 5.0.4 react-native-config: ~1.4.6 => 1.4.12 react-native-drawer: ~2.5.1 => 2.5.1 react-native-fast-image: ~8.5.11 => 8.5.12 react-native-fs: ~2.20.0 => 2.20.0 react-native-gesture-handler: ~2.8.0 => 2.8.0 react-native-get-random-values: ~1.9.0 => 1.9.0 react-native-image-picker: ~5.0.1 => 5.0.2 react-native-inappbrowser-reborn: ~3.7.0 => 3.7.0 react-native-paper: ~4.12.4 => 4.12.8 react-native-qrcode-svg: ~6.1.2 => undefined (6.1.2, ) react-native-reanimated: ~2.9.1 => 2.9.1 react-native-reanimated-carousel: ~3.1.3 => 3.1.5 react-native-render-html: ~6.3.4 => 6.3.4 react-native-safe-area-context: ~4.3.1 => 4.3.4 react-native-screens: ~3.15.0 => 3.15.0 react-native-snap-carousel: 4.0.0-beta.6 => 4.0.0-beta.6 react-native-svg: 12.1.1 => 12.1.1 react-native-svg-transformer: ^1.0.0 => 1.3.0 react-native-url-polyfill: ~1.3.0 => 1.3.0 react-native-vector-icons: ~9.2.0 => 9.2.0 react-native-vision-camera: ~2.15.4 => 2.15.6 react-native-webview: ~11.23.1 => 11.23.1 react-redux: ~8.0.2 => 8.0.7 react-test-renderer: 18.0.0 => 18.0.0 redux-persist: ~6.0.0 => 6.0.0 redux-persist/integration/react: undefined () rn-qr-generator: ~1.2.1 => 1.2.1 typescript: ^4.4.4 => 4.9.5 npmGlobalPackages: corepack: 0.22.0 npm: 10.2.3 ```

Describe the bug

Hi, how are you?.. Im having issues ONLY ANDROID with push notification, It was working until some days, then the pre-launch report from google play informed us about this bug.. later we builded the app and we were testing the notifications with aws pinpoint test messaging and when the phone receive the notification we get the same bug that google give us, a NRA error, on Iphone the notifications is working fine..

At this time we dont touch anything about notifications, module, version or packages

this is the message:

java.lang.RuntimeException: Unable to create service com.amazonaws.amplify.pushnotification.PushNotificationFirebaseMessagingService: java.lang.ClassNotFoundException: Didn't find class "com.amazonaws.amplify.pushnotification.PushNotificationFirebaseMessagingService"

Screenshot 2024-01-09 at 18 48 08

Expected behavior

get a notification on android

Reproduction steps

Follow guide to install V5 push notifications modules on react native Try to send a push notification with aws console

Code Snippet

// Put your code below this line.

Log output

``` // Put your logs below this line ```

aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

cwomack commented 10 months ago

@enzzoperez, sorry to hear that you're experience this! Can you clarify if any recent upgrades were made to either the aws-amplify package or another dependency that resulted in these errors happening? Are the consistently reproducible for every notification on the Android device or more sporadic? Hoping to get you unblocked ASAP.

enzzoperez commented 10 months ago

Thanks for response @cwomack .. No, we didnt make any changes/upgrades related to aws packages (ws-amplify nor @aws-amplify/rtn-push-notification), days ago the notifications was working well. We were trying to move to some previous version of our app, clean deps and re-build, but we got the same results.. And as you say, all notifications that we sent broke the app

Screenshot 2024-01-10 at 14 26 43
enzzoperez commented 10 months ago

udpate: we had to uninstall the @aws-amplify/rtn-push-notification package, then the pre-launch report told us that the bug was gone

we previously tried to downgrade versions of this package and aws-amplify, but the error remained

Screenshot 2024-01-11 at 10 29 03
Samaritan1011001 commented 10 months ago

Hi @enzzoperez, I was only able to reproduce the error you mentioned in the description when using an older version of @aws-amplify/rtn-push-notification.

Keeping all the other packages the same version as you show in the image above, can you only upgrade the @aws-amplify/rtn-push-notification to 1.2.12 and see if that solves the problem? I am trying to track down the root cause but upgrading as I mentioned solved it in my reproduction. Hope this helps.

This is my version set for reference,

"dependencies": {
    "@aws-amplify/rtn-push-notification": "~1.2.12",
    "@react-native-async-storage/async-storage": "^1.21.0",
    "@react-native-community/netinfo": "^9.5.0",
    "aws-amplify": "~5.3.11",
    "react": "18.2.0",
    "react-native": "0.71.5",
    "react-native-get-random-values": "^1.10.0",
    "react-native-url-polyfill": "^1.3.0"
  },
enzzoperez commented 9 months ago

Hi @Samaritan1011001 , sorry about delay, upgrading to rtn v1.2.12 works, thanks. Previously I'm upgrading to amplify v6 and also worked, so I thinks that I'll take the new version of package .. again, thanks for you workaround!

GERASM1 commented 4 days ago

Okay... I'm having the same issue, but problem is I can't upgrade rtn-push-notification because I'm using v5, and according to the docs. V5 doesn't work with later versions of rtn-push-notification. What can I do? If nothing, I think that v5 documentation should be updated to state it can't handle notifications.

GERASM1 commented 4 days ago

Update, despite being on v5, I upgraded rtn-push-notification to the latest version, and it worked (contrary to what the docs said). Not sure if I should leave it like that thought, I imagine the docs suggest you use 1.1.x. on v5 for a reason.