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] Desktop - Console error when opening the app #12492

Closed
kbecciv opened this issue Nov 5, 2022 · 38 comments
Closed

[$250] Desktop - Console error when opening the app #12492

kbecciv opened this issue Nov 5, 2022 · 38 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@kbecciv
Copy link

kbecciv commented Nov 5, 2022

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Issue found when executing PR #12296

Action Performed:

  1. Open app
  2. Check the console

Expected Result:

Should be no console error

Actual Result:

Error in console

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • Desktop App

Version Number: 1.2.24.0

Reproducible in staging?: Yes

Reproducible in production?: No

Email or phone of affected tester (no customers):

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Bug5806549_12296_desktop1.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 5, 2022
@melvin-bot
Copy link

melvin-bot bot commented Nov 5, 2022

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

@melvin-bot melvin-bot bot added the Overdue label Nov 7, 2022
@Santhosh-Sellavel
Copy link
Collaborator

@kbecciv
Note: This happens on production as well
#12296 is pending production deployment
Screenshot 2022-11-08 at 4 19 03 AM

@melvin-bot
Copy link

melvin-bot bot commented Nov 8, 2022

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

@flaviadefaria flaviadefaria added the External Added to denote the issue can be worked on by a contributor label Nov 8, 2022
@melvin-bot
Copy link

melvin-bot bot commented Nov 8, 2022

Current assignee @flaviadefaria is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Nov 8, 2022

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 8, 2022
@melvin-bot
Copy link

melvin-bot bot commented Nov 8, 2022

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

@melvin-bot melvin-bot bot changed the title Desktop - Console error when opening the app [$250] Desktop - Console error when opening the app Nov 8, 2022
@flaviadefaria
Copy link
Contributor

Adding the external label. I'll create the UW post tomorrow.

@melvin-bot melvin-bot bot removed the Overdue label Nov 8, 2022
@smrutiparida
Copy link
Contributor

smrutiparida commented Nov 10, 2022

Proposal:

The issue was introduced during upgrading Electron version from from 18.3.15 to 21.0.0 by me. I certainly missed it in checking all aspects in the PR ##11836

In a feature change released in Electron V20 electron/electron#28496 (comment) Sandbox setting was defaulted to value "true" from "false" based on nodeIntegration value set in the app code.

In that change, sandbox is enabled by default when nodeIntegration is false or unspecified (i.e. this PR). Hence our present sandbox:true where as previously it was sandbox:false.

Below change shall remove the error.

Screen Shot 2022-11-10 at 12 26 54

Screenshot:

Screen Shot 2022-11-10 at 12 27 50

A similar issue where i read about the fix is discussed here - electron/forge#2931

Please review @flaviadefaria @kbecciv

@melvin-bot melvin-bot bot added the Overdue label Nov 11, 2022
@flaviadefaria
Copy link
Contributor

@kbecciv @Luke9389 what are your thoughts on the solution @smrutiparida posted above?

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Nov 11, 2022
@Santhosh-Sellavel
Copy link
Collaborator

Why do we need to set nodeIntegration: true, what does it do other than remove the warning?

@melvin-bot melvin-bot bot removed the Overdue label Nov 14, 2022
@smrutiparida
Copy link
Contributor

smrutiparida commented Nov 15, 2022

Why do we need to set nodeIntegration: true, what does it do other than remove the warning?

Starting from Electron 20, the sandbox is enabled by default for renderer processes. When we run mainWindow as a separate process, the process is sandboxed. The sandbox limits the harm that malicious code can cause by limiting access to most system resources — sandboxed processes can only freely use CPU cycles and memory.

However running a preload script contextBridge.js require access to nodeJS modules from the javascript code. This was not a concern since sandbox used to be false by default for Electron <= 20

Starting from Electron 20, by doing nodeIntegration: true we set sandbox: false. I assumed this is safe which I after reading further thinks are not and need to be well tested. The APIs available in sandbox option to the preload script are more limited than nodeIntegration. Hence instead, I suggest only do sandbox:false now.

sandbox:false shall enable the Node.js engine and make NodeJS's features such as NodeJS's implementation of module, exports, and require to be accessible directly from the HTML/Javascript page's script context.

The Electron FAQ here explains it https://www.electronjs.org/docs/latest/faq#i-can-not-use-jqueryrequirejsmeteorangularjs-in-electron
More - https://www.electronjs.org/docs/latest/tutorial/sandbox#disabling-the-sandbox-for-a-single-process
https://www.electronjs.org/docs/latest/api/browser-window
electron/forge@6e0a6248

@Santhosh-Sellavel

@melvin-bot melvin-bot bot added the Overdue label Nov 16, 2022
@Santhosh-Sellavel
Copy link
Collaborator

I suggest only do sandbox:false now.

Seems straightforward, so looks good to me! Please have a look at this when you have time @Luke9389!

@melvin-bot melvin-bot bot removed the Overdue label Nov 17, 2022
@puneetlath
Copy link
Contributor

@Luke9389 this is one of the oldest issues in the /App repo. To help us clear out the large backlog of bugs, can you:

  • Decide whether any proposals currently meet our guidelines and can be approved as-is
  • For any that can't, please take this issue internal and treat it as one of your highest priorities
  • If you have any questions, don't hesitate to start a discussion in #bug-zero

@melvin-bot melvin-bot bot removed the Overdue label Nov 24, 2022
@smrutiparida
Copy link
Contributor

Not yet. Need a day more.

@Santhosh-Sellavel
Copy link
Collaborator

Seems like a simple and straightforward change, can you let us know what's causing the delay?

@smrutiparida
Copy link
Contributor

I need to create the screenshots in all devices of the errors not coming along with iOS. which is taking some time

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Nov 24, 2022

Again we are specifically modifying desktop-only code, so I think we don't need it for other platforms, only on this PR as we didn't touch native src code. Please include that in your PR description.

cc: @Luke9389

@iwiznia
Copy link
Contributor

iwiznia commented Nov 25, 2022

Sorry, not very clear, did we hire @smrutiparida? If so, can someone assign them so the help wanted label is removed?

@Santhosh-Sellavel
Copy link
Collaborator

@flaviadefaria please assign @smrutiparida issue.

@smrutiparida Any update on the PR?

@melvin-bot melvin-bot bot added the Overdue label Nov 28, 2022
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 28, 2022
@melvin-bot
Copy link

melvin-bot bot commented Nov 28, 2022

📣 @smrutiparida You have been assigned to this job by @flaviadefaria!
Please apply to this job in Upwork 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 📖

@flaviadefaria
Copy link
Contributor

Assigned @smrutiparida to the issue 👍

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Nov 28, 2022
@flaviadefaria
Copy link
Contributor

It seems like the PR is still being reviewed.

@melvin-bot melvin-bot bot removed the Overdue label Dec 1, 2022
@smrutiparida
Copy link
Contributor

I have applied in upwork for the job.

@melvin-bot
Copy link

melvin-bot bot commented Dec 5, 2022

@smrutiparida, @Luke9389, @flaviadefaria, @Santhosh-Sellavel Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Dec 5, 2022
@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Dec 5, 2022

PR is merged

@melvin-bot melvin-bot bot removed the Overdue label Dec 5, 2022
@flaviadefaria
Copy link
Contributor

Heads up I'm heading OoO for a week so in case this needs to be paid out before I come back then please reassign or ask someone else in the team to process the payment. Thanks!

@JmillsExpensify JmillsExpensify added the Reviewing Has a PR in review label Dec 8, 2022
@JmillsExpensify
Copy link

Still working on getting the linked PR deployed.

@flaviadefaria
Copy link
Contributor

It looks like the PR was deployed so I'll proceed to paying the contributors. Let me know in case I'm missing something.

@flaviadefaria
Copy link
Contributor

Offers sent in UW!

@Luke9389
Copy link
Contributor

Thanks @flaviadefaria

@flaviadefaria
Copy link
Contributor

Contributors paid, thanks!

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 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

9 participants