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.59k stars 2.92k forks source link

[HOLD for payment 2024-11-20] [$250] Netsuite - App crashes when submitting an expense after disconnecting from NetSuite #46508

Open lanitochka17 opened 4 months ago

lanitochka17 commented 4 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.14-2 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): N/A Issue reported by: Applause - Internal Team

Action Performed:

. Log in with a new expensifail account

  1. Create a new workspace
  2. Go to more features > Enable Accounting
  3. Go to Accounting > Connect to NetSuite
  4. Upgrade the workspace to Control > Navigate back to Accounting > Finish the connection to NetSuite
  5. Go to Accounting > Click on the 3 dot menu next to NetSuite
  6. Click on "Disconnect" > Confirm the disconnection > Check that the integration is removed from the workspace
  7. Navigate back from workspace page and go to FAB 9 Click on FAB > Submit Expense > Manual > Enter an amount
  8. Select the control workspace you disconnected NetSuite from

Expected Result:

The expense is submitted to the workspace

Actual Result:

App crashes

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/43e8344d-9d28-4f0e-bbe9-1130ed71a8e5

logs (2).txt

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a7f4450015473810
  • Upwork Job ID: 1819341847955308171
  • Last Price Increase: 2024-08-02
  • Automatic offers:
    • ShridharGoel | Contributor | 103438151
Issue OwnerCurrent Issue Owner: @eVoloshchak
melvin-bot[bot] commented 4 months ago

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

ShridharGoel commented 4 months ago

Proposal

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

App crashes when submitting an expense after disconnecting from NetSuite

What is the root cause of that problem?

This issue might happen if policyTagList or any tags within policyTagList is undefined or null.

https://github.com/Expensify/App/blob/df69c80229acdc510064d2671e2fdde8095a93a7/src/libs/OptionsListUtils.ts#L1402-L1406

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

function hasEnabledTags(policyTagList: Array<PolicyTagList[keyof PolicyTagList]>) {
    if (!policyTagList) {
        return false;
    }

    const policyTagValueList = policyTagList
        .filter(tag => tag && tag.tags) // Ensure tag and tag.tags are defined
        .map(({tags}) => Object.values(tags))
        .flat();

    return hasEnabledOptions(policyTagValueList);
}

We can check if we need to add similar checks as other places also.

ShridharGoel commented 4 months ago

CC: @luacmartins since I think you might be handling QBO/Netsuite bugs.

luacmartins commented 4 months ago

I think that'd be @yuwenmemon

ShridharGoel commented 4 months ago

Any plans to make this external?

melvin-bot[bot] commented 4 months ago

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

melvin-bot[bot] commented 4 months ago

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

bfitzexpensify commented 4 months ago

Setting this as external for the moment - @yuwenmemon is ooo until August 13th.

daledah commented 4 months ago

Proposal

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

Netsuite - App crashes when submitting an expense after disconnecting from NetSuite

What is the root cause of that problem?

In https://github.com/Expensify/App/blob/459759d55963091c708d7271c29e0f95f3add658/src/libs/PolicyUtils.ts#L272, we filter out empty tags by checking policyTagListValue !== null. However this is not enough, there could be empty tags that only has required field, this empty tag, when not omitted in https://github.com/Expensify/App/blob/459759d55963091c708d7271c29e0f95f3add658/src/libs/PolicyUtils.ts#L272, is returned in the tag list and will cause the crash here because it doesn't have important fields like the tags field.

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

We need to improve the empty tags filtering logic here https://github.com/Expensify/App/blob/459759d55963091c708d7271c29e0f95f3add658/src/libs/PolicyUtils.ts#L272 to filter out empty tags based on the name field as well, if it's a valid tag, it will always have name (we can see that name is a required field here)

.filter((policyTagListValue) => policyTagListValue?.name)

This will ensure the policyTagsList returned from getTagLists is always correct and not only will it fix this crash in hasEnabledTags but anywhere we use the policyTagLists from getTagLists will also behave correctly.

What alternative solutions did you explore? (Optional)

We can check by the existence of tags field. Regardless, the fix needs to be in getTagLists so policyTagLists is correct and consistent everywhere it's used

melvin-bot[bot] commented 3 months ago

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

eVoloshchak commented 3 months ago

Both proposals are fairly similar (different implementation, but same root cause and effectively the same fix, just in different place), I think we can proceed with @ShridharGoel's proposal

πŸŽ€πŸ‘€πŸŽ€ C+ reviewed!

melvin-bot[bot] commented 3 months ago

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

melvin-bot[bot] commented 3 months ago

πŸ“£ @ShridharGoel πŸŽ‰ An offer has been automatically sent to your Upwork account for the Contributor role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Keep in mind: Code of Conduct | Contributing πŸ“–

bfitzexpensify commented 3 months ago

@ShridharGoel when will you be able to raise a PR here?

ShridharGoel commented 3 months ago

https://github.com/Expensify/App/pull/47232 -> Marked as "InternalQA" since I don't have the credentials to Netsuite.

melvin-bot[bot] commented 2 months ago

This issue has not been updated in over 15 days. @eVoloshchak, @marcaaron, @ShridharGoel, @bfitzexpensify 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!

melvin-bot[bot] commented 1 month ago

@eVoloshchak, @marcaaron, @ShridharGoel, @bfitzexpensify, this Monthly task hasn't been acted upon in 6 weeks; closing.

If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.

eVoloshchak commented 3 weeks ago

This shouldn't be closed, PR fixing this is still open and close to being merged

melvin-bot[bot] commented 2 weeks ago

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

melvin-bot[bot] commented 2 weeks ago

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

If no regressions arise, payment will be issued on 2024-11-20. :confetti_ball:

For reference, here are some details about the assignees on this issue:

melvin-bot[bot] commented 2 weeks ago

@eVoloshchak @bfitzexpensify @eVoloshchak The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

ShridharGoel commented 1 week ago

Looks like this needs to be opened again for payment.

bfitzexpensify commented 1 week ago

Payment complete to @ShridharGoel

@eVoloshchak - please complete the BZ checklist and I'll finalise the payment summary for your C+ work - thanks!

melvin-bot[bot] commented 1 week ago

@eVoloshchak, @marcaaron, @ShridharGoel, @bfitzexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] commented 5 days ago

@eVoloshchak, @marcaaron, @ShridharGoel, @bfitzexpensify Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] commented 3 days ago

@eVoloshchak, @marcaaron, @ShridharGoel, @bfitzexpensify 6 days overdue. This is scarier than being forced to listen to Vogon poetry!