Skip to content

[$250] iOS&Android - App crashed when opening deeplink for changing workspace owner #70377

Closed

Description

@jponikarchuk

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.2.9-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: #70030
Email or phone of affected tester (no customers): tester@applausecard.expensifail.com
Issue reported by: Applause Internal Team
Device used: Realme C67 - Android 14, Apple iPhone 15 Pro - iOS 26.0
App Component: Other

Action Performed:

  1. Open App and login
  2. Open workspaces/:workspaceID/change-owner/78878/noBillingCard (for Native apps, paste this link to any chat and open it)

Expected Result:

Changing workspace owner page opens

Actual Result:

App crashed

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

1.mp4

troubleshoot (1).zip

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021967688851615177453
  • Upwork Job ID: 1967688851615177453
  • Last Price Increase: 2025-09-15
Issue OwnerCurrent Issue Owner: @bernhardoj

Activity

  1. added
    Daily
    Bug
    on Sep 11, 2025
  2. melvin-bot commented on Sep 11, 2025

    @melvin-bot

    Triggered auto assignment to @lydiabarclay (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.

  3. daledah commented on Sep 11, 2025

    @daledah
    Contributor

    Proposal

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

    App crashed

    What is the root cause of that problem?

    We get this erorr

    Image

    Because of we are calling the window.addEventListener in native os

    useEffect(() => {
    window.addEventListener('message', handleSCAAuthentication);
    return () => {
    window.removeEventListener('message', handleSCAAuthentication);
    };
    }, [handleSCAAuthentication]);

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

    We can check the os like we did here

    const canListenPopState = typeof window !== 'undefined' && typeof window.addEventListener === 'function';

    if (!canListenPopState) {
    return;
    }

        const canListenHandleAuthentication = typeof window !== 'undefined' && typeof window.addEventListener === 'function';
        ...
        useEffect(() => {
            if (!canListenHandleAuthentication) {
                return;
            }
            window.addEventListener('message', handleSCAAuthentication);
            return () => {
                window.removeEventListener('message', handleSCAAuthentication);
            };
        }, [handleSCAAuthentication, canListenHandleAuthentication]);
    

    Or we can create a new file index.native.ts to handle this

    Note: we will have a bug that when back from the Transfer owner screen, the page not found will appear, will be fixed in this PR

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    None

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. Eskalifer1 commented on Sep 11, 2025

    @Eskalifer1
    Contributor

    Proposal

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

    iOS&Android - App crashed when opening deepling for changing workspace owner

    What is the root cause of that problem?

    We use a component that can only be used in a browser environment, since its logic is tied to receiving the ‘message’ event, and window does not exist on native devices, which is why an error occurs.

    useEffect(() => {
    window.addEventListener('message', handleSCAAuthentication);
    return () => {
    window.removeEventListener('message', handleSCAAuthentication);
    };
    }, [handleSCAAuthentication]);

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

    We can discuss what decision we expect during the PR stage, but my main idea is as follows:
    Since we cannot simply ignore the hook (because part of the logic depends on it, and if it is missing, the application will not work as it should), I suggest using the same approach that we use on another page:
    The AddPaymentCard page is only available for the web environment:

    import React from 'react';
    import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView';
    import ScreenWrapper from '@components/ScreenWrapper';
    function AddPaymentCard() {
    return (
    <ScreenWrapper
    testID={AddPaymentCard.displayName}
    includeSafeAreaPaddingBottom
    shouldEnableMaxHeight
    >
    <FullPageNotFoundView shouldShow />
    </ScreenWrapper>
    );
    }
    AddPaymentCard.displayName = 'AddPaymentCard';
    export default AddPaymentCard;

    We need to do the same here, either cut out the entire page for native devices (return notFound and remove the link to it from the application) or only the part that relates to this logic (if possible), but this requires detailed discussion.

    For example, here we display this window, which will trigger the flow from CardAuthenticationModal depending on two parameters:

    {!policy?.isLoading && !shouldShowPaymentCardForm && (
    <WorkspaceOwnerChangeCheck
    policy={policy}
    accountID={accountID}
    error={error}
    />
    )}
    <CardAuthenticationModal
    headerTitle={translate('subscription.authenticatePaymentCard')}
    policyID={policyID}
    />
    </View>

    !policy?.isLoading && !shouldShowPaymentCardForm

    We can add another parameter, isNative, or create a separate component that will return notFound on native devices with information that it is only available in the browser, and on the web — what is currently available.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    Or we can make this CardAuthenticationModal component on native devices as some kind of informational window that will say that this functionality is only available in the web application, and display it on the web as it is now.
    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  5. bernhardoj commented on Sep 11, 2025

    @bernhardoj
    Contributor

    Proposal

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

    App crashes when deep link to change workspace owner page.

    What is the root cause of that problem?

    It crashes because the page renders CardAuthenticationModal, which uses a web API.

    useEffect(() => {
    window.addEventListener('message', handleSCAAuthentication);
    return () => {
    window.removeEventListener('message', handleSCAAuthentication);
    };
    }, [handleSCAAuthentication]);

    We encounter this issue on this PR when adding the transfer owner button, but as mentioned in the comment here, this component is only intended for the web.

    So, they hide the transfer owner button on native, except if fund list exist.

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

    First, we should show not found page for the transfer owner page if it's not supposed to be shown.

    <AccessOrNotFoundWrapper
    accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}
    policyID={policyID}
    >

    shouldBeBlocked={!shouldRenderTransferOwnerButton(fundList)}
    

    Also, since the user can't add a card on native, we should show not found page too when the error is noBillingCard.

    But if the user has a fund list, then the issue will happen again. So, we need to create a native file for CardAuthenticationModal that returns null.

    export default () => null;

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

  6. added
    External
    on Sep 15, 2025
  7. changed the title [-]iOS&Android - App crashed when opening deepling for changing workspace owner[/-] [+][$250] iOS&Android - App crashed when opening deepling for changing workspace owner[/+] on Sep 15, 2025
  8. melvin-bot commented on Sep 15, 2025

    @melvin-bot
  9. added
    Help Wanted
    on Sep 15, 2025
  10. melvin-bot commented on Sep 15, 2025

    @melvin-bot

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

  11. 8 remaining items

  12. bernhardoj commented on Sep 21, 2025

    @bernhardoj
    Contributor

    PR is ready

    cc: @rushatgabhane

  13. added and removed
    Weekly
    on Oct 15, 2025
  14. melvin-bot commented on Oct 15, 2025

    @melvin-bot

    This issue has not been updated in over 15 days. @blimpich, @rushatgabhane, @bernhardoj, @lydiabarclay eroding to Monthly issue.

    P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

  15. lydiabarclay commented on Oct 15, 2025

    @lydiabarclay
    Contributor

    Hey @rushatgabhane I'm assuming this is ready for payment, just the automation failed?

  16. rushatgabhane commented on Oct 15, 2025

    @rushatgabhane
    Member

    yes automation failed

  17. lydiabarclay commented on Oct 15, 2025

    @lydiabarclay
    Contributor

    Awesome, can you fill out the BZ checklist please?

  18. lydiabarclay commented on Oct 17, 2025

    @lydiabarclay
    Contributor

    Payment Summary

    Contributor: @bernhardoj due $250 via NewDot
    Contributor+: @rushatgabhane due $250 via NewDot

    ✅ Regression test filed

  19. bernhardoj commented on Oct 17, 2025

    @bernhardoj
    Contributor

    Requested in ND.

  20. lydiabarclay commented on Oct 23, 2025

    @lydiabarclay
    Contributor

    @rushatgabhane reminder that your payment is held on the checklist

  21. rushatgabhane commented on Oct 29, 2025

    @rushatgabhane
    Member

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: [NO QA] Feature: Implement SCA support to transfer owner #49411 (comment)

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: Not critical

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal Template

    Regression Test Proposal

    Precondition:

    Test:

    1. Deep link to change owner page: staging.new.expensify.com:8082/workspaces/:workspaceID/change-owner/78878/noBillingCard
    2. Verify it shows the not found page on Android & iOS. For others, it should show the billing card form as normal

    Do we agree 👍 or 👎

  22. garrettmknight commented on Nov 1, 2025

    @garrettmknight
    Contributor

    $250 approved for @rushatgabhane

  23. quinthar commented on Nov 2, 2025

    @quinthar
    Contributor

    $250 approved to @bernhardoj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugExternalMonthlyReviewing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions