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 2024-02-20] [HOLD for payment 2024-02-19] [HOLD for payment 2024-02-15] [$500] Camera doesn't load when trying to smartscan a receipt #36098

Closed
1 of 6 tasks
m-natarajan opened this issue Feb 7, 2024 · 42 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@m-natarajan
Copy link

m-natarajan commented Feb 7, 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: 1.4.38-1
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
Expensify/Expensify Issue URL:
Issue reported by: @rlinoz
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1707336890268789

Action Performed:

  1. Tap request money
  2. Press the round button to take a picture
  3. Tap the back arrow
  4. Again press the Button to take a picture

Expected Result:

Able to scan the receipt again

Actual Result:

Camera doesn't load when trying to smartscan

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

az_recorder_20240207_173011.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0176ddbc1361cf082e
  • Upwork Job ID: 1755378138365923328
  • Last Price Increase: 2024-02-07
  • Automatic offers:
    • situchan | Contributor | 28150580
    • aswin-s | Contributor | 28150626
@m-natarajan m-natarajan added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 7, 2024
Copy link

melvin-bot bot commented Feb 7, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0176ddbc1361cf082e

@melvin-bot melvin-bot bot changed the title Camera doesn't load when trying to smartscan a receipt [$500] Camera doesn't load when trying to smartscan a receipt Feb 7, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 7, 2024
Copy link

melvin-bot bot commented Feb 7, 2024

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

Copy link

melvin-bot bot commented Feb 7, 2024

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

@aswin-s
Copy link
Contributor

aswin-s commented Feb 8, 2024

Proposal

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

Camera fails to load after navigating away and then returning to it

What is the root cause of that problem?

When user captures the photo first time and navigate to next screen, camera is set inactive here.

const isCameraActive = useTabNavigatorFocus({tabIndex: cameraTabIndex});
return (
<Camera
ref={ref}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
isActive={isCameraActive}
/>
);
});

This causes the camera library to disable camera when users navigates away from TabNavigator. On refocus the video capture is re-enabled. However it throws below error.

 DEBUG  [warn] Error taking photo - {"name":"unknown/unknown","_code":"unknown/unknown","_message":"[unknown/unknown] Not bound to a valid Camera [ImageCapture:androidx.camera.core.ImageCapture-eab74056-9b89-4653-8288-e44bc9b65a66]"}

Though camera is enabled on refocus, photo capture fails. This looks like a bug in react-native-vision camera.

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

Looks like a fix is available upstream mrousavy/react-native-vision-camera#2339. But it is available only in release v3.70. We've pinned react-native-vision-camera at 2.16.5

"react-native-vision-camera": "2.16.5",

So one option is to upgrade to v3.7 which could be a major undertaking.

Instead what I found is that the camera gets re-enabled if we toggle the photo prop of Camera on refocus. This enables photo capture capabilities of camera on refocus and above error is not thrown any more.

    const isCameraActive = useTabNavigatorFocus({tabIndex: cameraTabIndex});
    return (
        <Camera
            ref={ref}
            // eslint-disable-next-line react/jsx-props-no-spreading
            {...props}
            isActive={isCameraActive}
            // Toggle the photo prop as well
            photo={isCameraActive}
        />
    );

Result

Record_2024-02-08-08-28-15_out.mp4

What alternative solutions did you explore? (Optional)

None

@trjExpensify
Copy link
Contributor

Asked in thread here. Is this a deploy blocker if on staging only, or a fire if it's already on prod? It's a core flow, so if the camera can't load to take a receipt that's pretty bad!

@mountiny
Copy link
Contributor

mountiny commented Feb 8, 2024

@aswin-s no we cannot simply update to v3, there are some feature missing unfortunately, like flash.

@janicduplessis @ishpaul777 any chance this could be stemming from this update? i see the camera worked for you both in the PR, not sure clearly ifyou have gone back and again to the camera, I would assume yes #35014

@aswin-s
Copy link
Contributor

aswin-s commented Feb 8, 2024

@mountiny I've detailed how we can fix this without a version upgrade

@hannojg
Copy link
Contributor

hannojg commented Feb 8, 2024

We are looking into it whether we can find a better solution than the proposed workaround, give us a moment please!

(longterm we should look into upgrading V3!)
Tracking issue for that is here

@ishpaul777
Copy link
Contributor

@janicduplessis @ishpaul777 any chance this could be stemming from this update?

It appears that the root cause is stemming from the react-native-vision-camera upstream, so i dont think this comes from autofocus PR, Also this is hard to reproduce (at least on my device) Camera turns active before i get the chance to click the capture button.

@izarutskaya
Copy link

I can reproduce it on Samsung M 52.
Build 1.4.38-2

Screen_Recording_20240208_144156_New.Expensify.mp4

@mountiny mountiny added the DeployBlockerCash This issue or pull request should block deployment label Feb 8, 2024
@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Feb 8, 2024
Copy link
Contributor

github-actions bot commented Feb 8, 2024

👋 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.

Copy link

melvin-bot bot commented Feb 8, 2024

Triggered auto assignment to @youssef-lr (Engineering), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

@izarutskaya
Copy link

Production -not reproduced

Screen_Recording_20240208_143925_New.Expensify.mp4

@mountiny
Copy link
Contributor

mountiny commented Feb 8, 2024

QA has confirmed this is not repro in production https://expensify.slack.com/archives/C9YU7BX5M/p1707397831272999?thread_ts=1707394006.658679&cid=C9YU7BX5M

Curious what change from the recent deploy could have caused this

@s77rt
Copy link
Contributor

s77rt commented Feb 8, 2024

This is a regression from #32471 where react-native-vision-camera was upgraded from 2.16.2 to 2.16.5. I tested with 2.16.7 and that version is still buggy. Since this is a deploy blocker we should go with the workaround suggested by @aswin-s photo={isCameraActive && props.photo}.

🎀 👀 🎀 C+ reviewed
Link to proposal

Copy link

melvin-bot bot commented Feb 8, 2024

Current assignee @youssef-lr is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@mountiny
Copy link
Contributor

mountiny commented Feb 8, 2024

@situchan can you please continue with the review on the PR

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Feb 8, 2024
@melvin-bot melvin-bot bot changed the title [$500] Camera doesn't load when trying to smartscan a receipt [HOLD for payment 2024-02-15] [$500] Camera doesn't load when trying to smartscan a receipt Feb 8, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 8, 2024
Copy link

melvin-bot bot commented Feb 8, 2024

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

Copy link

melvin-bot bot commented Feb 8, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.38-6 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 2024-02-15. 🎊

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

Copy link

melvin-bot bot commented Feb 8, 2024

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:

  • [@situchan] The PR that introduced the bug has been identified. Link to the PR:
  • [@situchan] 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:
  • [@situchan] 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:
  • [@situchan] Determine if we should create a regression test for this bug.
  • [@situchan] 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.
  • [@garrettmknight] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@mrousavy
Copy link
Contributor

mrousavy commented Feb 8, 2024

Released in latest vc2 tag on npm.

@mountiny mountiny removed the DeployBlockerCash This issue or pull request should block deployment label Feb 8, 2024
hannojg added a commit to margelo/expensify-app-fork that referenced this issue Feb 9, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Weekly KSv2 labels Feb 9, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Feb 12, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-02-15] [$500] Camera doesn't load when trying to smartscan a receipt [HOLD for payment 2024-02-19] [HOLD for payment 2024-02-15] [$500] Camera doesn't load when trying to smartscan a receipt Feb 12, 2024
Copy link

melvin-bot bot commented Feb 12, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 12, 2024
Copy link

melvin-bot bot commented Feb 12, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.39-8 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 2024-02-19. 🎊

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

Copy link

melvin-bot bot commented Feb 12, 2024

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:

  • [@situchan] The PR that introduced the bug has been identified. Link to the PR:
  • [@situchan] 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:
  • [@situchan] 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:
  • [@situchan] Determine if we should create a regression test for this bug.
  • [@situchan] 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.
  • [@garrettmknight] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Feb 13, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-02-19] [HOLD for payment 2024-02-15] [$500] Camera doesn't load when trying to smartscan a receipt [HOLD for payment 2024-02-20] [HOLD for payment 2024-02-19] [HOLD for payment 2024-02-15] [$500] Camera doesn't load when trying to smartscan a receipt Feb 13, 2024
Copy link

melvin-bot bot commented Feb 13, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.40-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 2024-02-20. 🎊

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

Copy link

melvin-bot bot commented Feb 13, 2024

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:

  • [@situchan] The PR that introduced the bug has been identified. Link to the PR:
  • [@situchan] 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:
  • [@situchan] 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:
  • [@situchan] Determine if we should create a regression test for this bug.
  • [@situchan] 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.
  • [@garrettmknight] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

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. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests