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-06-11] App crashes due to trying to access accountIdToName prop in epensimark on an undefined variable #42161

Closed
iwiznia opened this issue May 14, 2024 · 29 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@iwiznia
Copy link
Contributor

iwiznia commented May 14, 2024

Context https://expensify.slack.com/archives/C04878MDF34/p1715699038416249

image

image

Issue OwnerCurrent Issue Owner: @twisterdotcom
@iwiznia iwiznia added the Bug Something is broken. Auto assigns a BugZero manager. label May 14, 2024
@iwiznia iwiznia self-assigned this May 14, 2024
Copy link

melvin-bot bot commented May 14, 2024

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

@melvin-bot melvin-bot bot added the Daily KSv2 label May 14, 2024
@war-in
Copy link
Contributor

war-in commented May 14, 2024

Hi, I'm Marcin from Software Mansion and I would like to work on this

@twisterdotcom
Copy link
Contributor

Doesn't look like I'm needed here as no C+ reviewed these PRs, but LMK if anybody needs paying.

@ahmedGaber93
Copy link
Contributor

@robertKozik @war-in I think we still have a type error as here we use accountIdToName with Id, but its type here defines as accountIDToName with ID

@robertKozik
Copy link
Contributor

Yeah you're right, there is typo in the types. I'll spin up the PR soon

Copy link

melvin-bot bot commented May 31, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@MonilBhavsar MonilBhavsar removed the Reviewing Has a PR in review label May 31, 2024
@melvin-bot melvin-bot bot added the Overdue label May 31, 2024
@MonilBhavsar
Copy link
Contributor

We've reverted PR #42176 that updated expensify-common version in the App, because it caused multiple crashes.

The crash will happen again if we update expensify-common version in the App for some reason. Can anyone please fix the issue from root cause i.e. in expensify-common please. Thanks!

@MonilBhavsar MonilBhavsar added Daily KSv2 and removed Weekly KSv2 labels May 31, 2024
@melvin-bot melvin-bot bot removed the Overdue label May 31, 2024
@twisterdotcom
Copy link
Contributor

Who is responsible for this now @iwiznia or @war-in - or should we take this External for some help?

@iwiznia
Copy link
Contributor Author

iwiznia commented May 31, 2024

@war-in said they would work on it and I assigned them.

@melvin-bot melvin-bot bot added the Overdue label Jun 3, 2024
@twisterdotcom
Copy link
Contributor

Nice, okay @war-in let us know if you need any help here.

@war-in
Copy link
Contributor

war-in commented Jun 3, 2024

@iwiznia @twisterdotcom I've found what the bug is. This PR introduced Log to expensify-common (ExpensiMark.js) and it turned out it doesn't work on mobile (jquery is not present there).
To quick-fix it we can change Log.alert to console.warn as the information provided by the Logger won't be helpful until my PR enabling editing mentions is merged.

Please share your thoughts 🙏

@iwiznia
Copy link
Contributor Author

iwiznia commented Jun 3, 2024

nd it turned out it doesn't work on mobile (jquery is not present there).

I don't get this. What part of Log.alert uses jquery?

@war-in
Copy link
Contributor

war-in commented Jun 3, 2024

Based on this error I found the line which uses jquery. Network is used by Log.alert

Screen.Recording.2024-06-03.at.12.58.10.mov

@iwiznia
Copy link
Contributor Author

iwiznia commented Jun 3, 2024

Hmmmm why is it using that? We call Log.alert in app already. I think the OG PR imported the wrong log library. It imported Log.jsx and should've imported Logger.jsx?

@blazejkustra
Copy link
Contributor

I think the callstack looks like this:

$.ajax(...);
Network.post(...)
API.performPOSTRequest(...)
API.logToServer(...)
Logger.serverLoggingCallback(...)
Logger.logToServer(...)
Logger.add(...)
Log.alert(...)

Where serverLoggingCallback in this case is defined in lib/Log.jsx:

function serverLoggingCallback(logger, params) {
    return API(Network('/api/')).logToServer(params);
}

export default new Logger({
    serverLoggingCallback,
    clientLoggingCallback,
    isDebug: isWindowAvailable() ? window.DEBUG : false,
});

@iwiznia
Copy link
Contributor Author

iwiznia commented Jun 3, 2024

The Log we use in App is defined here 🤔

@blazejkustra
Copy link
Contributor

The Log in expensify-common uses Logger:

export default new Logger({
    serverLoggingCallback,
    clientLoggingCallback,
    isDebug: isWindowAvailable() ? window.DEBUG : false,
});

@blazejkustra
Copy link
Contributor

blazejkustra commented Jun 3, 2024

Looking at the code serverLoggingCallback won't work on mobile because it is using jquery, and clientLoggingCallback doesn't really differ from using console.warn as suggested here 🤔

Also Log isn't used anywhere in expensify-common, there is only one invocation in PubSub module which isn't imported in E/App, any suggestions how to proceed?

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jun 4, 2024
@melvin-bot melvin-bot bot changed the title App crashes due to trying to access accountIdToName prop in epensimark on an undefined variable [HOLD for payment 2024-06-11] App crashes due to trying to access accountIdToName prop in epensimark on an undefined variable Jun 4, 2024
Copy link

melvin-bot bot commented Jun 4, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.78-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-06-11. 🎊

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

  • @war-in does not require payment (Contractor)

Copy link

melvin-bot bot commented Jun 4, 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:

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

@ikevin127
Copy link
Contributor

1st PR for this was reverted.

@sonialiap
Copy link
Contributor

I can't access a chat with a client, possible same issue https://github.com/Expensify/Expensify/issues/403390

@iwiznia
Copy link
Contributor Author

iwiznia commented Jun 10, 2024

@war-in @blazejkustra we are missing re-updating the version of expensify commons the App uses, no?

@war-in
Copy link
Contributor

war-in commented Jun 10, 2024

Afaik @blazejkustra updated the expensify-common in this PR. It includes a fix for this bug.
And I'm almost finished with the mentions editing PR here

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 10, 2024
@twisterdotcom
Copy link
Contributor

Okay, Is this ready for payment yet or not? Does it even need payment? Perhaps only for @ikevin127 somewhere?

@ikevin127
Copy link
Contributor

@twisterdotcom I reviewed the initial PR as C+ but it was reverted in #42914, therefore no payment is due here and the hold for payment can be removed.

Not sure if I'm still needed as reviewer for PR number 2 🤔

Copy link

melvin-bot bot commented Jun 11, 2024

Skipping the payment summary for this issue since all the assignees are employees or vendors. If this is incorrect, please manually add the payment summary SO.

@sonialiap
Copy link
Contributor

I was able to load the chat today without issue 😁 thank you for the fix!

@twisterdotcom
Copy link
Contributor

Looks like it was internally reviewed. Okay, closing this then.

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. Daily KSv2
Projects
None yet
Development

No branches or pull requests

9 participants