Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.5k stars 2.85k forks source link

[$250] Track- Error appears when Submit expense to someone #45086

Open lanitochka17 opened 3 months ago

lanitochka17 commented 3 months ago

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.5-3 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4704990&group_by=cases:section_id&group_order=asc&group_id=309130 Email or phone of affected tester (no customers): gocemate+a573@gmail.com

Action Performed:

  1. Login with new account
  2. Go to Self DM> Track expense
  3. Submit the expense to someone
  4. Wait for a minute

Expected Result:

There should be no errors and submitted expense should be present on LHN and report

Actual Result:

Red dot and error appears after Submit expense to someone

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/78819774/e719bca2-468b-491e-a7e0-3b5721e2c76f

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01408041e16e8fde12
  • Upwork Job ID: 1815525298284767197
  • Last Price Increase: 2024-08-08
melvin-bot[bot] commented 3 months ago

Triggered auto assignment to @alexpensify (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 commented 3 months ago

@alexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

alexpensify commented 3 months ago

This one is on my testing list. I'll review it soon.

melvin-bot[bot] commented 3 months ago

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

alexpensify commented 3 months ago

No update, I'll test soon

alexpensify commented 3 months ago

Other GHs have been a priority, I'll review soon

alexpensify commented 3 months ago

I was able to replicate the experience in my Android application

image

image

melvin-bot[bot] commented 3 months ago

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

melvin-bot[bot] commented 3 months ago

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

alexpensify commented 3 months ago

We need proposals here.

melvin-bot[bot] commented 3 months ago

@alexpensify @Pujan92 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!

alexpensify commented 3 months ago

Open for proposals here

melvin-bot[bot] commented 2 months ago

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

pasyukevich commented 2 months ago

Hi, I'm Eugene from Callstack - expert contributor group. I’d like to work on this issue.

melvin-bot[bot] commented 2 months ago

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

alexpensify commented 2 months ago

Thanks, @pasyukevich! I've assigned this one to you.

alexpensify commented 2 months ago

@pasyukevich any update on when the PR will be ready for review? Thanks!

pasyukevich commented 2 months ago

I was able to reproduce the issue on Android. I am looking for the root cause and don't have an ETA yet for the PR.

Do you also mean that here we do not need to have the proposal step and I need to create the PR?

jacobkim9881 commented 2 months ago

@alexpensify Hi. Is the issue still open to proposal? If it is, I would like to investigate this issue.

alexpensify commented 2 months ago

@pasyukevich - No, you would create the PR only.


@jacobkim9881 this one is not open right now. Thanks for your interest.

alexpensify commented 2 months ago

Moving to Weekly while @pasyukevich works on this one.

melvin-bot[bot] commented 2 months ago

@alexpensify @Pujan92 @pasyukevich this issue is now 4 weeks old, please consider:

Thanks!

melvin-bot[bot] commented 2 months ago

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

trjExpensify commented 2 months ago

@thienlnam any context on why we add this "changed the expense" system message in this flow? 🤔

thienlnam commented 2 months ago

We add a MODIFIEDEXPENSE reportAction when the tracked expense is submitted to someone for historical context. However, I'm not sure that message is ideal for this scenario. I think we just need to change the copy here maybe to something like 'submitted tracked expense'?

trjExpensify commented 2 months ago

Why did we decide to add aMODIFIEDEXPENSE reportAction for historical context of an expense being submitted not modified? 🤔

I think we just need to change the copy here maybe to something like 'submitted tracked expense'?

Even this doesn't seem necessary. If I go to Submit expense > Jack, we don't add the "submitted $x" reportAction in the iouReport. So why do we need to do that here? The only time we use that reportAction is when a workspace has delayed submission enabled and the expense report is actually submitted (be that manually, or via harvesting).

iouReports are the equivalent of instant submit, where the concept of having to submit a report doesn't exist. So I think we remove this reportAction altogether.

thienlnam commented 2 months ago

This was a tracked expense, and then when it was submitted it became a reimbursable expense which is why it has a modified reportAction. I feel like there needs to be some indication that something happened to this tracked expense

JmillsExpensify commented 2 months ago

But they don't know one way or the other right? Like a tracked expense is basically secretly non-reimbursable.

trjExpensify commented 2 months ago

^^ I agree with that

thienlnam commented 2 months ago

I don't think it matters to the person that is getting the expense submitted to them, but for the person that created the tracked expense it might be nice to see that this tracked expense has been updated and is now being submitted to someone.

Though I don't feel that strongly so if you want we can remove the reportAction that gets added when the expense is moved

trjExpensify commented 2 months ago

I think redirecting them to the DM and seeing this preview that reads " owes:" is fine, personally.

image
alexpensify commented 2 months ago

@pasyukevich—The team has replied with feedback. Do you have enough information to continue with the PR, or should we have a larger discussion in the Open Source Slack room? Thanks for the update!

pasyukevich commented 2 months ago

@alexpensify I am not sure, still investigating the exact reason - A larger discussion will be helpful

I've found on the android a few different flows of this problem:

  1. Unsynced state with BE - when we send straight after the creation of the convertTrackedExpenseToRequest and receive a response with the not found state (this is reproducible also on other platforms, floating bug)
  2. multiple requests of convertTrackedExpenseToRequest - we send convertTrackedExpenseToRequest and receive a response with status 200, but straight after it sends one more and receives 401 (as the previous request has already converted it) - error at the app as a result

    I'm focused on the 2nd case as it reproduces only on the Android constantly (1st - floating problem)

    It was hard to investigate the exact flow, since on the js level we always have the same error - [TypeError: Network request failed] (even if convertTrackedExpenseToRequest succeeded on the native side )

I've configured the logs from the native Android and network sides with exact errors - it is much easier to investigate the root cause

alexpensify commented 2 months ago

Ok, I'll start one tomorrow.

CyberAndrii commented 1 month ago

Coming from https://github.com/Expensify/App/issues/48238. This error is caused by the Receipt.type property being undefined. We had a similar issue before: https://github.com/Expensify/App/issues/26940#issuecomment-1740445802.

receipt must be either undefined or has a value assigned to the type property. You can quickly fix it with this change:

diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts
index 29d48173779..4414d8221c7 100644
--- a/src/libs/actions/IOU.ts
+++ b/src/libs/actions/IOU.ts
@@ -3553,7 +3553,7 @@ function requestMoney(
                 createdChatReportActionID,
                 createdIOUReportActionID,
                 reportPreviewReportActionID: reportPreviewAction.reportActionID,
-                receipt,
+                receipt: receipt && Object.keys(receipt).length === 0 ? undefined : receipt,
                 receiptState: receipt?.state,
                 category,
                 tag,

This will only partially fix the issue as there are more places where a file is passed but the type is missing.

alexpensify commented 1 month ago

I'm catching up from being OOO last week and will start the required discussion soon.

alexpensify commented 1 month ago

No update

alexpensify commented 1 month ago

Other GitHubs have been a priority, I'll get to this one soon.

alexpensify commented 4 weeks ago

I've been sick this week and haven't been able to review this GitHub. There is no major update here; I'll try to carry on next week.

pasyukevich commented 3 weeks ago

I've rechecked the issue - it is still reproducible with the same logs

alexpensify commented 3 weeks ago

No update

alexpensify commented 2 weeks ago

@Pujan92 - I should have put this one on hold for https://github.com/Expensify/App/issues/48238, but that one went into production recently. Can you please confirm what's left, as this appears to be a multilevel issue, or should we close this GH? Thanks!

alexpensify commented 1 week ago

@Pujan92 any update here? Thanks!

alexpensify commented 1 week ago

Heads up, I will be offline until Tuesday, October 22, 2024, and will not actively watch over this GitHub during that period.

If this GitHub requires an urgent update, please ask for help in the #expensify-open-source Slack Room. If the inquiry can wait, I'll review it when I return online.

Pujan92 commented 1 week ago

I see the same error as @pasyukevich mentioned

[Network] API request error: Connection interruption likely - "Network request failed"

@pasyukevich, is there any update about why this error is being thrown?

flaviadefaria commented 5 days ago

@al, this makes more sense as part of #convert since this is part of the bottom-up adoption workflow.

pasyukevich commented 4 days ago

@Pujan92 There are no updates, the latest one - https://github.com/Expensify/App/issues/45086#issuecomment-2293900646

CyberAndrii commented 4 days ago

[Network] API request error: Connection interruption likely - "Network request failed"

See https://github.com/Expensify/App/issues/45086#issuecomment-2323920107 for why this happens