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

[$250] QBO - Connection options are missing in QBO connection #46445

Open
2 of 6 tasks
lanitochka17 opened this issue Jul 29, 2024 · 58 comments
Open
2 of 6 tasks

[$250] QBO - Connection options are missing in QBO connection #46445

lanitochka17 opened this issue Jul 29, 2024 · 58 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 29, 2024

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: 9.0.14-1
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Log in to the app with a new expensifail account
  2. Create a new workspace
  3. Go to more features > enable accounting
  4. Navigate to the accountings page and connect with QBO
  5. When you are navigated to the QBO page enter the credentials and finish the connection
  6. After connecting with QBO, you will be navigated to the app
  7. Wait for the connection to sync

Expected Result:

QBO options (Import, Export, Card reconciliation and Advanced options) are displayed

Actual Result:

QBO options (Import, Export, Card reconciliation, and Advanced options) are not displayed

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6556582_1722281658856.2024-07-29_22_24_02.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @ishpaul777
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021841525897082466980
  • Upwork Job ID: 1841525897082466980
  • Last Price Increase: 2024-10-09
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 29, 2024
Copy link

melvin-bot bot commented Jul 29, 2024

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

@lanitochka17 lanitochka17 added DeployBlockerCash This issue or pull request should block deployment DeployBlocker Indicates it should block deploying the API and removed Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 29, 2024
Copy link

melvin-bot bot commented Jul 29, 2024

Triggered auto assignment to @tgolen (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave-collect - Release 1

@tgolen
Copy link
Contributor

tgolen commented Jul 29, 2024

@kosmydel @hungvu193 @arosiclair Is it possible this is related to #44733 ?

@arosiclair
Copy link
Contributor

I don't think so. Those changes should only affect report exports.

@chiragsalian chiragsalian removed the DeployBlocker Indicates it should block deploying the API label Jul 29, 2024
@chiragsalian
Copy link
Contributor

Not a web-e blocker as discussed here

@tgolen tgolen assigned yuwenmemon and unassigned tgolen Jul 29, 2024
@tgolen
Copy link
Contributor

tgolen commented Jul 29, 2024

Sounds like @yuwenmemon might know what's happened here and he will be looking into it.

@yuwenmemon
Copy link
Contributor

Weird, not able to reproduce this in Dev

@yuwenmemon
Copy link
Contributor

Oh I see it now. @NikkiWines it looks like this is because we initially set the lastSync isConnected property to false:
https://github.com/Expensify/Integration-Server/commit/a4cca1bb4863dfcbe9c566cbeeaa47d5676c8c72#diff-49d9c0cf9775a8c0d9890e99f5085ddbed36dbe92d1d8ec3a3956e50d5d9a555R27

@yuwenmemon
Copy link
Contributor

I think this will need to be fixed via the IS.

Copy link

melvin-bot bot commented Jul 30, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@hungvu193
Copy link
Contributor

@yuwenmemon I can reproduce this issue.
As I checked the logs, Pusher events never seem to push updates after QBO was connected until the next manual sync (I tried to logout and login again but it didn't work).

Screenshot 2024-10-03 at 14 16 42

If we show a loading when credentials are not empty and data is empty, it will load infinitely. So I think in this case, if we don't update the BE, we should change the FE behavior for QBO.

If

Specifically for QuickBooks Online, the case would be if we see quickbooksOnline.config.credentials but not quickbooksOnline.data

We should let users know that they need to do another sync ( or we can do it inside PolicyAccount with an useEffect).
What do you think 🤔 ?

@trjExpensify
Copy link
Contributor

I don't think we want to ask them to do a manual sync just after connecting for the first time. That seems like a bad design, so can we trigger that if necessary?

@hungvu193
Copy link
Contributor

hungvu193 commented Oct 5, 2024

Cool. Agreed. I'll post a proposal based on my idea above

@melvin-bot melvin-bot bot added the Overdue label Oct 5, 2024
@ishpaul777
Copy link
Contributor

not overdue, waiting for proposals

@melvin-bot melvin-bot bot removed the Overdue label Oct 5, 2024
@hungvu193
Copy link
Contributor

While working on proposal, I realized this issue was fixed. Is there anyone here can reproduce it? 😂

@trjExpensify
Copy link
Contributor

Don't you have to simulate a crappy network and delay thejobDone event as Yuwen did here?

@hungvu193
Copy link
Contributor

Don't you have to simulate a crappy network and delay thejobDone event as Yuwen did here?

In this comment, I'm seeing Yuwen is debugging in his local BE env, I'm not sure if I can replicate with only my local FE setup 😨

@yuwenmemon
Copy link
Contributor

@hungvu193 I'm happy to work with you to test any solution you drum up with my debugger setup.

@melvin-bot melvin-bot bot added the Overdue label Oct 7, 2024
@hungvu193
Copy link
Contributor

@hungvu193 I'm happy to work with you to test any solution you drum up with my debugger setup.

Sure thing. But I wonder if anyone can still reproduce this issue? I can reproduce it easily a few days ago. However, I can't reproduce it now.

@ishpaul777
Copy link
Contributor

wonder if anyone can still reproduce this issue?

i'll try reproducing in few hours today

@melvin-bot melvin-bot bot removed the Overdue label Oct 8, 2024
Copy link

melvin-bot bot commented Oct 9, 2024

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

@ishpaul777
Copy link
Contributor

ishpaul777 commented Oct 9, 2024

was not able to reproduce the options came as soon as sync completed (staging v9.0.46-4)

Screen.Recording.2024-10-09.at.10.57.05.PM.mov

@hungvu193
Copy link
Contributor

@trjExpensify can you request QA to retest this one? If they can't reproduce then I think we can close this one

@twisterdotcom twisterdotcom added the retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause label Oct 10, 2024
@yuwenmemon
Copy link
Contributor

yuwenmemon commented Oct 11, 2024

I can still reproduce this (notice the moment when I move the mouse a lot - you can still see a split second where we have the connection options missing but the sync has "finished"):

Kapture.2024-10-10.at.17.36.02.mp4

Like I said in my earlier post, I'm happy to work with anyone who has a proposal / branch to test if their solution solves what I'm seeing.

@yuwenmemon yuwenmemon removed the retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause label Oct 11, 2024
@aldo-expensify
Copy link
Contributor

I can still reproduce this (notice the moment when I move the mouse a lot - you can still see a split second where we have the connection options missing but the sync has "finished"):

but... is that a bug? I would be concern if the menu options don't ever appear.. but if they have such a small delay 🤷

@aldo-expensify
Copy link
Contributor

I have something kind of related here: #49372, but opposite? Opposite because the menu options appear too soon.

I think the problem in my issue is that we show the options but we still load some data after... so if you are quick in changing something it may get reverted.

@yuwenmemon
Copy link
Contributor

Well, if something were to happen where, for whatever reason, the Push notification came from the IS for the job to be done but the data from the sync did not, it would be more severe.

I agree, though; the small flash is not the worst bug in the world. However, it's still a bug nevertheless.

@hungvu193
Copy link
Contributor

Proposal

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

QBO - Connection options are missing in QBO connection

What is the root cause of that problem?

As described above, the RCA of this issue is race condition and sits at the heart of how the new connection with Onyx updates works. Our FE received jobDone event from our Pusher event, even when we didn't have lastDate data yet, so we will see the Last synced without the date:

isSyncInProgress && connectionSyncProgress?.stageInProgress
? translate('workspace.accounting.connections.syncStageName', {stage: connectionSyncProgress.stageInProgress})
: translate('workspace.accounting.lastSync', {relativeDate: datetimeToRelative}),

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

This is QBO case-specific, so we can add a condition in our isConnectionInProgress function, if we see qboConnection?.data but not qboConnection?.config?.credentials, we still want to display the loading indicator.

Let's update isConnectionInProgress function to the following:

function isConnectionInProgress(connectionSyncProgress: OnyxEntry<PolicyConnectionSyncProgress>, policy?: OnyxEntry<Policy>): boolean {
    if (!policy) {
        return false;
    }

    const qboConnection = policy?.connections?.quickbooksOnline;

    const lastSyncProgressDate = parseISO(connectionSyncProgress?.timestamp ?? '');
    return (
        (!!connectionSyncProgress?.stageInProgress &&
            (connectionSyncProgress.stageInProgress !== CONST.POLICY.CONNECTIONS.SYNC_STAGE_NAME.JOB_DONE || !policy?.connections?.[connectionSyncProgress.connectionName]) &&
            isValid(lastSyncProgressDate) &&
            differenceInMinutes(new Date(), lastSyncProgressDate) < CONST.POLICY.CONNECTIONS.SYNC_STAGE_TIMEOUT_MINUTES) ||
// If qboConnection?.data is null and !!qboConnection?.config?.credentials is true, then it's still in progress.
        (!!qboConnection && !qboConnection?.data && !!qboConnection?.config?.credentials)
    );
}

What alternative solutions did you explore? (Optional)

N/A

Result
Screen.Recording.2024-10-11.at.16.52.59.mov

@hungvu193
Copy link
Contributor

Here's the test branch: https://github.com/hungvu193/App/tree/fix-qbo-syncing

@ishpaul777
Copy link
Contributor

you can still see a split second where we have the connection options missing but the sync has "finished"

@hungvu193 have you been able to reproduce #46445 (comment)

for me the options are visible before the sync is completed 🤔

Screen.Recording.2024-10-12.at.5.00.50.PM.mov

@hungvu193
Copy link
Contributor

Yeah I can still reproduce, you can try with brand new workspace.

@ishpaul777
Copy link
Contributor

ishpaul777 commented Oct 12, 2024

Same with new workspace and even new account. options come before "last synced date"

Screen.Recording.2024-10-12.at.10.40.48.PM.mov

@hungvu193
Copy link
Contributor

I think I still can reproduce on latest main

Screenshot 2024-10-14 at 08 42 22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
Status: Release 2.5: SuiteWorld (Sept 9th)
Development

No branches or pull requests