Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2023-05-22] [$1000] An error message shows up after sign in on "Connect to bank" page #18156

Closed
1 of 6 tasks
kavimuru opened this issue Apr 28, 2023 · 41 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Apr 28, 2023

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


Action Performed:

  1. Go to Avatar > Workspaces > Select a workspace > Issue card > Connect Bank Account
  2. Clear cookies and site data
  3. Reload the page
  4. Sign in through magic link
  5. Notice the error message that shows up on the connect bank account page

Expected result:

There should not be any error message being shown

Actual result:

An error message shows up and disappears

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.8-4
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
image (3)

2023-04-28.11.37.43.mp4

Expensify/Expensify Issue URL:
Issue reported by: @Nathan-Mulugeta
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1682671566260029

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d4564169525a8256
  • Upwork Job ID: 1653136896355336192
  • Last Price Increase: 2023-05-01
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 28, 2023
@MelvinBot
Copy link

Triggered auto assignment to @joekaufmanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@MelvinBot
Copy link

MelvinBot commented Apr 28, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@honnamkuan
Copy link
Contributor

honnamkuan commented Apr 29, 2023

Posting proposal early as per new guidelines

Proposal

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

If browser cookies and site data is cleared while user has Workspaces > Connect bank account page opened, when user refresh and sign in again using magic code, the same page is initially displayed with validateAccountError error message, and then it disappears.

The error message should not appear as the user is validated.

Same issue also happens if user has signed out and then paste URL for policy add new bank account (e.g. https://new.expensify.com/bank-account/new?policyID=F6EA7D851A6603F6) into Chrome browser to sign in again.

What is the root cause of that problem?

Right after entering magic code to sign in, user is routed to the previous Workspaces > Connect bank account page, the order of API calls to backend is SignInUser, followed by OpenApp.

Before any of the API calls are completed, BankAccountStep user props has default value of {}

const defaultProps = {
receivedRedirectURI: null,
plaidLinkOAuthToken: '',
user: {},

which causes account error message to show up according based on the rendering condition here
{!props.user.validated && (
<View style={[styles.flexRow, styles.alignItemsCenter, styles.m4]}>
<Icon src={Expensicons.Exclamation} fill={colors.red} />
<Text style={[styles.mutedTextLabel, styles.ml4, styles.flex1]}>
{props.translate('bankAccount.validateAccountError')}
</Text>
</View>
)}

Note: prop.user.validated is undefined (falsey) at this stage, the logical NOT ! set the display condition to true.

When SignInUser completes, the API response will merge {isUsingExpensifyCard: [boolean]} to user key in Onyx. At this stage, the user props still do not contains the validated key, therefore the error message is still being displayed by mistake.

Upon getting response from the second API call OpenApp, the API response triggers merging of
{isSubscribedToNewsletter: [bool], validated: true, isUsingExpensifyCard: [bool]} to the user key in Onyx, which makes props.user.validated to have value defined and equals to true, hence the error message is no longer displayed.

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

We should display loading page if either SignInUser and OpenApp calls are still in progress, by making changes to ReimbursementAccountPage.js:

  1. injecting report and account loading indicator props through adding
        isLoadingReportData: {
            key: ONYXKEYS.IS_LOADING_REPORT_DATA,
        },
        account: {
            key: ONYXKEYS.ACCOUNT,
        },

to

  1. add defaultProps
    isLoadingReportData: false,
    account: {},
  1. add propTypes
    /** Indicated whether the report data is loading */
    isLoadingReportData: PropTypes.bool,

    /** Holds information about the users account that is logging in */
    account: PropTypes.shape({
        /** Whether a sign on form is loading (being submitted) */
        isLoading: PropTypes.bool,
    }),
  1. change the IF condition for display of ReimbursementAccountLoadingIndicator from
    // Don't show the loading indicator if we're offline and restarted the bank account setup process
    if (this.props.reimbursementAccount.isLoading && !(this.props.network.isOffline && currentStep === CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT)) {
    const isSubmittingVerificationsData = _.contains([
    CONST.BANK_ACCOUNT.STEP.COMPANY,
    CONST.BANK_ACCOUNT.STEP.REQUESTOR,
    CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT,
    ], currentStep);
    return (
    <ReimbursementAccountLoadingIndicator
    isSubmittingVerificationsData={isSubmittingVerificationsData}
    onBackButtonPress={this.goBack}
    />
    );
    }

    to the following:
const isLoading = this.props.isLoadingReportData || this.props.account.isLoading || this.props.reimbursementAccount.isLoading;

if ((!this.state.hasACHDataBeenLoaded || isLoading) && !(this.props.network.isOffline && currentStep === CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT)) {
    ...as is..
}

Note: When the page is being accessed for the first time, and none of the data loading has started yet, page will have state.hasACHDataBeenLoaded : false, and isLoading : false, we want to display loading indicator at this time, hence the condition (!this.state.hasACHDataBeenLoaded || isLoading) is there to display the loader before any data loading begins, and when data is being loaded

What alternative solutions did you explore? (Optional)

N/A

Test Results
Screen.Recording.2023-05-05.at.10.57.25.AM.mov

@melvin-bot melvin-bot bot added the Overdue label May 1, 2023
@joekaufmanexpensify
Copy link
Contributor

Will triage today.

@melvin-bot melvin-bot bot removed the Overdue label May 1, 2023
@joekaufmanexpensify
Copy link
Contributor

Reproduced on web Safari.

2023-05-01_16-34-51.mp4

@joekaufmanexpensify joekaufmanexpensify added the External Added to denote the issue can be worked on by a contributor label May 1, 2023
@melvin-bot melvin-bot bot changed the title An error message shows up after sign in on "Connect to bank" page [$1000] An error message shows up after sign in on "Connect to bank" page May 1, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

Current assignee @joekaufmanexpensify is eligible for the External assigner, not assigning anyone new.

@MelvinBot
Copy link

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 1, 2023
@MelvinBot
Copy link

Triggered auto assignment to @aldo-expensify (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@joekaufmanexpensify
Copy link
Contributor

Pending proposals

@honnamkuan
Copy link
Contributor

@joekaufmanexpensify just would like to highlight that I have submitted my proposal above for your review.
Thanks.

@joekaufmanexpensify
Copy link
Contributor

Ah, yep. Thanks! @eVoloshchak thoughts on this proposal?

@joekaufmanexpensify
Copy link
Contributor

Still pending review of proposal

@eVoloshchak
Copy link
Contributor

@honnamkuan's, awesome investigation!

That means that if the account isn't validated (i.e. has validated: false), the error will appear after the screen is displayed, correct? I think the correct behavior would be to show loading spinner while fetching user data, we're already displaying it, could we also show it while OpenApp is in progress?

@honnamkuan
Copy link
Contributor

@eVoloshchak thank you for the feedbacks!

Yes if either SignInUser or OpenApp is in progress, we will get validated: falsey (it is actually undefined), that causes the error to appear until the API completes.

I think it totally makes sense to show loading spinner which fetching user data (either user account or report data), I have updated my proposal to show the loading spinner while user data are being loaded by making changes in ReimbursementAccountPage.js, really appreciate if you can review on it again.

@joekaufmanexpensify
Copy link
Contributor

Still discussing proposal.

@eVoloshchak
Copy link
Contributor

@honnamkuan's updated proposal looks good to me

🎀👀🎀 C+ reviewed!
cc: @aldo-expensify

@aldo-expensify
Copy link
Contributor

Thanks @honnamkuan for the investigation/proposal and @eVoloshchak !

Lets do #18156 (comment) then.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 5, 2023
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels May 15, 2023
@melvin-bot melvin-bot bot changed the title [$1000] An error message shows up after sign in on "Connect to bank" page [HOLD for payment 2023-05-22] [$1000] An error message shows up after sign in on "Connect to bank" page May 15, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 15, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 15, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented May 15, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.13-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-05-22. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented May 15, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

@joekaufmanexpensify
Copy link
Contributor

@honnamkuan was assigned to this issue on 2023-05-05, and the PR was merged on 2023-05-09. The 6th, and 7th, were weekend days though, which means the PR was merged on the 2nd business day after assignment. This qualifies for a speed bonus.

So we need to pay:

@joekaufmanexpensify
Copy link
Contributor

@honnamkuan offer sent for $1,000!

@joekaufmanexpensify
Copy link
Contributor

@eVoloshchak offer sent for $1,000!

@joekaufmanexpensify
Copy link
Contributor

@Nathan-Mulugeta offer sent for $250!

@joekaufmanexpensify
Copy link
Contributor

@eVoloshchak LMK once you've had a chance to work on the BZ checklist steps/if you think we should add a regression test here.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 21, 2023
@joekaufmanexpensify
Copy link
Contributor

Once we finish the BZ checklist we can issue payment here. @eVoloshchak mind working through your steps?

@joekaufmanexpensify
Copy link
Contributor

Bumped here.

@eVoloshchak
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: Store account validated state and display error early on VBA flow #5524

  • 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: https://github.com/Expensify/App/pull/5524/files#r1202363101

  • A discussion in #expensify-bugs 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: I don't think an additional discussion is needed here, this was just an edge case missed during the initial implementation

  • Determine if we should create a regression test for this bug.
    Is it easy to test for this bug? Yes
    Is the bug related to an important user flow? Yes
    Is it an impactful bug? No

    The bug has an extremely low impact (error message appearing for a split second) and isn't something many users would encounter, since it requires you to sign out while being on connect to bank page (by clearing your cache, but I suspect auth session can be terminated from another device) and then sign back in in the same tab

@joekaufmanexpensify
Copy link
Contributor

Got it, ty! I agree a regression test here isn't really necessary.

@joekaufmanexpensify
Copy link
Contributor

joekaufmanexpensify commented May 23, 2023

BZ checklist is complete! All set to issue payment.

@joekaufmanexpensify
Copy link
Contributor

@honnamkuan $1,500 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

@eVoloshchak $1,500 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

@Nathan-Mulugeta $250 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

Upwork job closed.

@joekaufmanexpensify
Copy link
Contributor

Bug is fixed, BZ checklist complete, and all payment issued. Closing as this is all set. Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants