You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2023-10-09] [$500] Request Money - App crashes when invalid id entered in the url while requesting money #28182
Edit the url and change the id number to something invalid.
Expected Result:
The app should show the not found page
Actual Result:
App crashes
Workaround:
Unknown
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.74.0 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
changed the title [-]Request Money - App crashes when invalid id entered in the url while requesting money[/-][+][$500] Request Money - App crashes when invalid id entered in the url while requesting money[/+]on Sep 25, 2023
We are trying to get the report.policyID but when the reportID is invalid, it returns the report as undefined so we are trying to access a property on undefined which is causing the error.
What changes do you think should be made to fix this problem?
Option 1
We have started to allow optional chaining in the codebase, so we can use report?.policyID to prevent this error.
What other alternative options did you explore? (Optional)
Option 3
We can use the typical lodashGet(report, 'policyID', CONST.POLICY.OWNER_EMAIL_FAKE) here instead as well, if we don't want to use optional chaining.
@esh-g Thanks for the proposal. Your RCA is correct and the solutions makes sense. Given this is a regression from #27172 I think the C/C+ may handle this. cc @waterim@0xmiroslav
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:
[@s77rt] The PR that introduced the bug has been identified. Link to the PR:
[@s77rt] 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:
[@s77rt] 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:
[@s77rt] Determine if we should create a regression test for this bug.
[@s77rt] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
[@sonialiap / @sophiepintoraetz] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
Activity
[-]Request Money - App crashes when invalid id entered in the url while requesting money[/-][+][$500] Request Money - App crashes when invalid id entered in the url while requesting money[/+]melvin-bot commentedon Sep 25, 2023
Triggered auto assignment to @sophiepintoraetz (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Sep 25, 2023
Job added to Upwork: https://www.upwork.com/jobs/~012ee95879b3ee9fee
melvin-bot commentedon Sep 25, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Sep 25, 2023
Triggered auto assignment to @sonialiap (
External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.melvin-bot commentedon Sep 25, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt (
External)kbecciv commentedon Sep 25, 2023
Proposal by: @esh-g
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1695485570103699
Proposal
Please re-state the issue
App crashes when invalid id entered in the url while requesting money
What is the root cause of the problem?
We actually have logic in the
MoneyRequestConfirmPageto reset theIOUin case there is a mismatch between the currentiou.idand thereportIDhere:App/src/pages/iou/steps/MoneyRequestConfirmPage.js
Lines 99 to 104 in 5aa7f6d
But this crash is occurring before the above code is getting executed. Here is where the error is occurring:
App/src/pages/iou/steps/MoneyRequestConfirmPage.js
Lines 380 to 384 in 5aa7f6d
We are trying to get the
report.policyIDbut when thereportIDis invalid, it returns thereportasundefinedso we are trying to access a property onundefinedwhich is causing the error.What changes do you think should be made to fix this problem?
Option 1
We have started to allow optional chaining in the codebase, so we can use
report?.policyIDto prevent this error.Option 2
We can copy the approach how we handle this from the
EditRequestPage.jsfile:App/src/pages/EditRequestPage.js
Lines 226 to 228 in 5aa7f6d
What other alternative options did you explore? (Optional)
Option 3
We can use the typical
lodashGet(report, 'policyID', CONST.POLICY.OWNER_EMAIL_FAKE)here instead as well, if we don't want to use optional chaining.s77rt commentedon Sep 25, 2023
@esh-g Thanks for the proposal. Your RCA is correct and the solutions makes sense. Given this is a regression from #27172 I think the C/C+ may handle this. cc @waterim @0xmiroslav
19 remaining items
melvin-bot commentedon Oct 2, 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:
s77rt commentedon Oct 3, 2023
sophiepintoraetz commentedon Oct 5, 2023
Hi @sonialiap! Looks like this was a fortuitous double-assignment - I'm headed OOO till 17 Oct so all that needs doing here is:
(I have paid the reporter already)
sonialiap commentedon Oct 12, 2023
The offer link is not working for me so I've sent a new one - https://www.upwork.com/nx/wm/offer/27157108
s77rt commentedon Oct 12, 2023
@sonialiap Accepted! Thanks!
sonialiap commentedon Oct 13, 2023
Paid 🎉