App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Android - Notification - App crashes when launching app from notification

Open lanitochka17 opened this issue 1 month ago • 17 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.2.75-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: Exp Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Samsung Galaxy S25 FE / Android 16 App Component: Notifications

Action Performed:

  1. Launch Expensify app.
  2. Background the app.
  3. Receive a notification from another user.
  4. Open the notification.
  5. Background the app.
  6. Receive a notification from another user.
  7. Kill the app.
  8. Open the notification.
  9. Might need to repeat Step 6 to 8.

Expected Result:

App will not crash.

Actual Result:

App crashes when launching app from notification. Was able to semi-reproduce once but only the New expensify part as I got the refresh app screen on the first notification.

Workaround:

Unknown

Platforms:

  • [x] Android: App
  • [ ] Android: mWeb Chrome
  • [ ] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [ ] Windows: Chrome
  • [ ] MacOS: Chrome / Safari

Screenshots/Videos

Bug7026348_1765456013071!log.txt

https://github.com/user-attachments/assets/a8526f7c-85d7-48de-80ec-5cd50dbb622b

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021999620262973499384
  • Upwork Job ID: 1999620262973499384
  • Last Price Increase: 2025-12-19
Issue OwnerCurrent Issue Owner: @yuwenmemon

lanitochka17 avatar Dec 11 '25 18:12 lanitochka17

Triggered auto assignment to @stephanieelliott (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

melvin-bot[bot] avatar Dec 11 '25 18:12 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~021999620262973499384

melvin-bot[bot] avatar Dec 12 '25 23:12 melvin-bot[bot]

Triggered auto assignment to Contributor-plus team member for initial proposal review - @Krishna2323 (External)

melvin-bot[bot] avatar Dec 12 '25 23:12 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

Android - Notification - App crashes when launching app from notification

What is the root cause of that problem?

It was introduced from this pr and commit

PushNotificationBridge is null because Headless JS can run without the native module being initialized, and the code assumes it always exists.

https://github.com/Expensify/App/blob/0c92ee767ee420c5ba4cb50a1ed9e0695c4f2077/src/libs/Notification/PushNotification/subscribeToPushNotifications.ts#L109-L111

What changes do you think we should make in order to solve the problem?

We have to ensure that finishBackgroundProcessing is called only when PushNotificationBridge exists.


const bridge = NativeModules.PushNotificationBridge;

if (bridge?.finishBackgroundProcessing) {
    bridge.finishBackgroundProcessing();
}

What alternative solutions did you explore? (Optional)

marufsharifi avatar Dec 13 '25 06:12 marufsharifi

@Krishna2323 Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Dec 16 '25 00:12 melvin-bot[bot]

Hey @Krishna2323 can you take a look at the proposal ?

stephanieelliott avatar Dec 16 '25 23:12 stephanieelliott

Reviewing...

Krishna2323 avatar Dec 17 '25 13:12 Krishna2323

There seems to be an issue when logging in with a new account. I’ll try again later today or tomorrow and report back. Thanks for waiting!

Image

Krishna2323 avatar Dec 17 '25 14:12 Krishna2323

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Dec 19 '25 16:12 melvin-bot[bot]

I'll check this again today.

Krishna2323 avatar Dec 19 '25 16:12 Krishna2323

I was able to reproduce the issue on my physical device using the app downloaded from the Play Store, but I wasn’t able to reproduce it on the emulator or on a physical device using the dev build.

The proposal looks promising. I just need to test the proposed changes. I’ll try again tomorrow.

@marufsharifi, let me know if you know a good way to test this. Thanks!

Krishna2323 avatar Dec 19 '25 21:12 Krishna2323

@Krishna2323 thanks for the update. The on-screen development error, TypeError: Cannot read property 'finishBackgroundProcessing' of null, directly causes the app to crash in production because the PushNotificationBridge native module is not being correctly loaded, resulting in a fatal unhandled exception.

https://github.com/user-attachments/assets/d600f581-653f-4d2b-8623-fdfdde07e0eb

marufsharifi avatar Dec 20 '25 12:12 marufsharifi

@Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Dec 23 '25 00:12 melvin-bot[bot]

I’ll review it again today.

Krishna2323 avatar Dec 23 '25 00:12 Krishna2323

@marufsharifi’s proposal looks good to me! @arosiclair, could you please have a look at the proposal since it’s related to this issue? Thanks!

🎀 👀 🎀 C+ Reviewed

Krishna2323 avatar Dec 24 '25 22:12 Krishna2323

Triggered auto assignment to @yuwenmemon, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Dec 24 '25 22:12 melvin-bot[bot]

@yuwenmemon @stephanieelliott @Krishna2323 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Dec 25 '25 21:12 melvin-bot[bot]

Issue not reproducible during KI retests. (First week)

mvtglobally avatar Dec 27 '25 02:12 mvtglobally

@marufsharifi @Krishna2323 please also update the type definition to make PushNotificationBridge optional.

Also use the background test here

arosiclair avatar Dec 29 '25 15:12 arosiclair

📣 @marufsharifi You have been assigned to this job! Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻 Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs! Keep in mind: Code of Conduct | Contributing 📖

melvin-bot[bot] avatar Dec 29 '25 15:12 melvin-bot[bot]

Thanks, I will raise the pr tomorrow morning.

marufsharifi avatar Dec 30 '25 08:12 marufsharifi

@Krishna2323, pr is ready for your review. thanks.

marufsharifi avatar Dec 30 '25 10:12 marufsharifi

@marufsharifi were you able to access these steps?

@arosiclair could you please share the steps, I don't have access to that repo. Thanks!

Krishna2323 avatar Dec 30 '25 10:12 Krishna2323

@marufsharifi were you able to access these steps?

@arosiclair could you please share the steps, I don't have access to that repo. Thanks!

@Krishna2323, no, I don't have them. I thought you had access to those and would test them. Thanks for the follow-up

marufsharifi avatar Dec 30 '25 10:12 marufsharifi

Ah sorry here is the test:

Android & iOS - Background push notification update

  1. Log into HybridApp iOS/Android
  2. Switch to the new experience
  3. Enable push notifications
  4. Settings > Troubleshoot > Soft kill the app
  5. Send a DM to the current account
  6. Verify a push notification is received
  7. Wait 1 minute
  8. Enable airplane mode
  9. Reopen the app
  10. Verify
    • the new message appears in the LHN
    • the message appears in the chat

Note: This is a known flakey test. If this doesn't work, wait 30 minutes and try again

arosiclair avatar Dec 30 '25 14:12 arosiclair

@Krishna2323, I don't have access to HybridApp. Do I have to test? Or you will test it. thanks

marufsharifi avatar Dec 30 '25 15:12 marufsharifi