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.51k stars 2.87k forks source link

New chats sent to me aren't showing in Desktop/Web. #9382

Closed mvtglobally closed 2 years ago

mvtglobally commented 2 years 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!


Action Performed:

  1. Either put computer to sleep and/or closed lid
  2. Noticed incoming chat via phone notification
  3. Open/unlock computer
  4. New chat that was sent doesn't show up in LHN

Additional repro steps:

  1. Ask someone to send chat in 15 secs on Desktop
  2. Have the chat open and desktop foregrounded
  3. Close laptop lid
  4. Wait for a minute (or two?)
  5. Open laptop (Macbook pro M1 for me) and observe the test messages don't show in LHN or in main chat window

Expected Result:

For chat to show in LHN

Actual Result:

Chats do not show in LHN until you refresh

Workaround:

unknown

Platform:

Where is this issue occurring?

Version Number: 1.1.75-0 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation

https://user-images.githubusercontent.com/43995119/172922211-55f6bee7-4b5e-43b2-9e0a-a6b9ca511e31.MP4

image - 2022-06-09T145132 608

IMG_8489BA3F8F58-1 2

image - 2022-06-09T145115 343 image - 2022-06-09T145108 893

Expensify/Expensify Issue URL: Issue reported by: @mallenexpensify Applause Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1654795218684169

View all open jobs on GitHub

melvin-bot[bot] commented 2 years ago

Triggered auto assignment to @yuwenmemon (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

Beamanator commented 2 years ago

PR to try to fix this (at least the onResubscribe error) here: https://github.com/Expensify/App/pull/9381

mallenexpensify commented 2 years ago

@Beamanator this is still happening to me on Version 1.1.88-7 - Staging Any reason we shouldn't reopen this GH since the deets are the same? Also, more details and logs in #expensify-open-source https://expensify.slack.com/archives/C01GTK53T8Q/p1660149965758469

Beamanator commented 2 years ago

Weird! Ok so this time I see this error which doesn't look good:

ENSURE_BUGBOT unknown error caught while processing request - Unexpected token < in JSON at position 0 - {"command":"OpenApp","message":"Unexpected token < in JSON at position 0"}
Beamanator commented 2 years ago

Looks like this error has been happening for a decent amount of us, daily (logs) for commands ReconnectApp mainly, but sometimes even for OpenApp

Beamanator commented 2 years ago

Making only daily b/c this doesn't seem to be a deploy blocker - seems to be on production too, and my email exists in the logs too, while I've been able to send messages the last few days - so doesn't seem it happens often enough to cause panic

Beamanator commented 2 years ago

cc @luacmartins since you worked on both ReconnectApp and OpenApp - have you seen these types of errors during dev or anything? (error: Unexpected token < in JSON at position 0)

luacmartins commented 2 years ago

I have not, but this error suggests that we are sending an html doc as response to OpenApp?!?! Note <!DOCTYPE

 [alXt] ENSURE_BUGBOT unknown error caught while processing request - Unexpected token '<', "<!DOCTYPE "... is not valid JSON ~~ command: 'OpenApp' message: 'Unexpected token '<', "<!DOCTYPE "... is not valid JSON' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36'
luacmartins commented 2 years ago

I tried to repro this on dev, staging and prod but no luck so far. Maybe we can wrap ReconnectApp in a try-catch and throw that error so we have a full stack trace to work with?

Beamanator commented 2 years ago

Hmm ok continuing looking..

Also seeing [OOPS!] JSON error: Malformed UTF-8 characters, possibly incorrectly encoded in this set of logs which is interesting

And this info log error a lot: Report action type doesn't have a JSON message

Beamanator commented 2 years ago

Here's some logs from my account, today, which include the <!DOCTYPE in the error 🤔

It's looking like this error comes from whatever is returned from GetChats

Beamanator commented 2 years ago

The message TransactionIDs are not converted to string is logged right before the JSON error, and this log comes from here, so it looks like the JSON encoding that throws the error is here: https://github.com/Expensify/Web-Expensify/blob/fb989976fa034cdc726f6c4d26ec38c26ce48d08/api.php#L2925

Beamanator commented 2 years ago

I suggest we either add some logs so we know exactly what is not encoding well - it could be due to the <!DOCTYPE message found in some logs, it could be some emojis or weird characters that are encoded weird when stored, then we're having trouble decoding them, not sure! Unassigning b/c I really need to focus on some other things at the moment

luacmartins commented 2 years ago

I'll pick this up since it's related to the OpenApp/ReconnectApp commands

marcaaron commented 2 years ago

We observed this while looking into some issues @gabrielessner was having in the fireroom here:

https://expensify.slack.com/archives/C03SYCHD988/p1660765334591779?thread_ts=1660679114.219859&cid=C03SYCHD988

More logs here in case they are helpful:

https://www.expensify.com/_devportal/tools/logSearch/#sort=asc&size=10000&query=blob%3A%20%22Unexpected%20token%20'%3C'%2C%20%22%3C!DOCTYPE%20%22...%20is%20not%20valid%20JSON%22%20AND%20timestamp%3A%5B2022-08-03T00%3A00%20TO%202022-08-18T23%3A59%5D

It would probably be good to have more of the JSON revealed/logged when it fails to get parsed?

luacmartins commented 2 years ago

This is the response https://expensify.slack.com/archives/C03SYCHD988/p1660766084000099?thread_ts=1660679114.219859&cid=C03SYCHD988

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”><html xmlns=“http://www.w3.org/1999/xhtml”><head><meta http-equiv=“Content-Type”content=“text/html; charset=UTF-8”/><meta http-equiv=“X-UA-Compatible”content=“IE=Edge,chrome=1”><meta name=“viewport”content=“width=device-width”><!--[if lte IE 9]>
            <script type=“text/javascript”>
                var sPath = window.location.pathname;
                var sPage = sPath.substring(sPath.lastIndexOf(‘/’) + 1);
                if (sPage != “browserupgrade”)
                window.location=“browserupgrade”;
            </script>
        <![endif]-->
        <title>Expensify - Api</title>
        <link rel=“icon” type=“image/png” href=“https://d2k5nsl2zxldvw.cloudfront.net/images/expensify-favicon.png”>
            <meta name=“keywords” content=“expense report, expense report template, expenses, small business expense, expense reimbursement, card import, travel expense, conference”/>
        <meta name=“description” content=“Import expenses directly from a credit card to create free expense reports quickly.  Approve reports online and reimburse directly to a checking account with one click.“/>
        <meta name=“robots” Content=“Index,Follow” />
        <link rel=“stylesheet” type=“text/css” href=“https://d2k5nsl2zxldvw.cloudfront.net/dist/css-gz/style.04750fac.css.gz” />
        <link rel=“chrome-webstore-item” href=“https://chrome.google.com/webstore/detail/oiicpdkmeclmgmlmbajefnkalcfageek”>
        <style type=“text/css”>
        </style>
    </head>
    <body id=“api” class=“year2022 month08 day17 week33 Wednesday ofh”>
        <div id=“loadingBackground”>
            <div class=“spinner spinner-large”></div>
        </div>
        <div id=“loadingImage”>
            <div id=“loader”></div>
            <div id=“loadingText”></div>
            <div class=“loadingMessagesWrapper hidden”>
                <div class=“loadingMessagesTitle” id=“loadingTitle”></div>
                <div id=“loadingMessages”>
                    <ul id=“loadingList”></ul>
                </div>
            </div>
        </div>
        <!-- Checkbox to show menu -->
<input type=“checkbox” id=“menu-toggle” />
    <div class=“sidepane sidepane--guest production”>
            <div class=“sidepane__logo”>
    <a href=“/signout?clean=true”>
        <h1 class=“expensify_com”>Expensify</h1>
    </a>
</div>
<div class=“sidepane__nav”>
    <ul role=“navigation”>
        <li>
            <a href=“/signin”>
                <span class=“expensicons expensicons-switch”></span>Sign In
            </a>
        </li>
        <li>
            <a href=“/signup”>
                <span class=“expensicons expensicons-user-add”></span>Sign Up
            </a>
        </li>
    </ul>
</div>
    </div>
    <!-- Menu icon for smaller screen sizes -->
    <label for=“menu-toggle” class=“menu-icon”>
        <span></span>
    </label>
    <!-- App content overlay (only visible when sidepane is expanded) -->
    <label for=“menu-toggle” class=“sidepane-overlay”></label>
        <div class=“app-content-wrapper”>
            <div id=“bannerAnnouncement” class=“banner-announcement”>
    <div id=“bannerAnnouncement_chromeExtension” class=“hidden banner-announcement__inner”>
        <a target=“_blank” id=“bannerAnnouncement_chromeExtension_trigger”>Try the new Expensify extension for Google Chrome&trade;!</a> &nbsp;<a class=“expensicons expensicons-remove expensicons-sm”></a>
    </div>
</div>
            <div class=“app-content”>
                <div id=“content_wrapper” role=“main”>
                    <div class=“page-header”>
    <h1></h1>
</div>
<div>
    JSON error: Malformed UTF-8 characters, possibly incorrectly encoded
</div>
                </div>
            </div>
        </div>
    <div class=“app-footer”>
        <div class=“clearfix”>
            <ul class=“app-footer__links textLinks”>
                <li><a href=“https://use.expensify.com/terms” target=“_blank” rel=“noopener noreferrer” title=“Terms”>Terms</a></li>
                <li><a href=“https://www.expensify.com/privacy” target=“_blank” rel=“noopener noreferrer”>Privacy</a></li>
                <li><a href=“https://use.expensify.com/licenses” target=“_blank” rel=“noopener noreferrer”>Licenses</a></li>
                <li><a href=“http://status.expensify.com/” target=“_blank” rel=“noopener noreferrer” title=“Status”>Status</a></li>
            </ul>
            <div class=“app-footer__copyright”>
                &copy; 2008-2022 Expensify, Inc.
            </div>
        </div>
    </div>
        <div id=“dialog_overlay”></div>
        <div id=“reports_popup_user_menu” class=“reports_popup right_align hidden”>
    <div class=“reports_popup_inner_tb”>
            <span class=“submenuheader”>
                <div class=“userPictureLarge”>
                    <div class=“changePicture js_changePicture”>Change</div>
                </div>
                <p class=“userEmail selectable”>
                    <span id=“userHandleWelcomeMessage” class=“userSubtext”>Welcome back,</span>
                    <strong><span id=“userHandleDisplay” class=“nomargin”></span></strong>
                    <span id=“userHandleEmailSubtext” class=“userSubtext hidden”></span>
                </p>
                    <div class=“marginTop js_signout”>
                        <a href=“/signout”>
                            <span class=“expensicons expensicons-switch expensicons-sm depreciated vAlignMiddle inlineBlock”></span>
                            <span class=“vAlignMiddle inlineBlock”>Sign Out</span>
                        </a>
                    </div>
                <div class=“marginTop” id=“delegateReturnHome”>
                    <a href=“#”>
                        <span class=“expensicons expensicons-switch expensicons-sm depreciated vAlignMiddle inlineBlock”></span>
                        <span class=“vAlignMiddle inlineBlock”>Return to your account</span>
                    </a>
                </div>
            </span>
        <div id=“delegatedAccessContainer”>
            <div class=“link label”>Copilot access:</div>
            <div id=“delegateAccessList”></div>
        </div>
        <div class=“link js_viewChanges”>
            <span class=“expensicons expensicons-megaphone expensicons-sm depreciated floatLeft marginRight5"></span>
            <span class=“badge success floatRight hidden”>NEW!</span> <a href=“#”>Product Changes</a>
        </div>
        <div class=“link js_help-feedback”>
            <span class=“expensicons expensicons-question-mark-circle expensicons-sm depreciated floatLeft marginRight5"></span>
            <a href=“#”>Help and Feedback</a>
        </div>
        <!-- <div class=“link js_changePicture”><a href=“#”>Change your Profile Picture with Gravatar</a></div> -->
        <div id=“activePolicySelectorContainer” class=“hidden”>
            <div class=“link label”>Use this expense policy:</div>
            <div id=“activePolicyList”></div>
        </div>
    </div>
</div>
        <div style=“display:none;“>
            <form id=“saveascsv_form” action=“/jsontocsv” method=“POST”>
                <input type=“hidden” id=“saveascsv_data_input” name=“csvData” />
                <input type=“hidden” id=“saveascsv_header_input” name=“csvHeader” />
                <input type=“hidden” id=“saveascsv_filename_input” name=“filename” />
                <input type=“hidden” id=“saveascsv_type_input” name=“type” />
                <input type=“submit” id=“saveascsv_submit_button” />
            </form>
        </div>
        <script type=“text/javascript”>
            DEBUG = 0;
        </script>
        <!--************************************************************************
                TEMPLATES
        *************************************************************************-->
            <script type=“text/javascript” src=“https://d2k5nsl2zxldvw.cloudfront.net/dist/js-gz/module-vendor.ec0f3593.js.gz”> </script>
            <script type=“text/javascript” src=“https://d2k5nsl2zxldvw.cloudfront.net/dist/js-gz/module-shared.e4c775c8.js.gz”> </script>
            <script type=“text/javascript” src=“https://d2k5nsl2zxldvw.cloudfront.net/dist/js-gz/module-expensify.516d1cce.js.gz”> </script>
            <script type=“text/javascript” src=“https://d2k5nsl2zxldvw.cloudfront.net/dist/js-gz/module-external.1a4f98e4.js.gz”> </script>
            <script type=“text/javascript” src=“https://d2k5nsl2zxldvw.cloudfront.net/dist/js-gz/module-deprecated.cb41ef2e.js.gz”> </script>
            <script type=“text/javascript” src=“https://d2k5nsl2zxldvw.cloudfront.net/dist/js-gz/module-lib.0c24662b.js.gz”> </script>
            <script type=“text/javascript” src=“https://d2k5nsl2zxldvw.cloudfront.net/dist/js-gz/module-class.271d4bf7.js.gz”> </script>
            <script type=“text/javascript” src=“https://d2k5nsl2zxldvw.cloudfront.net/dist/js-gz/module-mixin.d41d8cd9.js.gz”> </script>
            <script type=“text/javascript” src=“https://d2k5nsl2zxldvw.cloudfront.net/dist/js-gz/module-component.67447144.js.gz”> </script>
            <script type=“text/javascript” src=“https://d2k5nsl2zxldvw.cloudfront.net/dist/js-gz/module-app.e996dbd1.js.gz”> </script>
            <script type=“text/javascript” src=“https://d2k5nsl2zxldvw.cloudfront.net/dist/js-gz/module-homepage.ca80d44f.js.gz”> </script>
            <script type=“text/javascript” src=“https://d2k5nsl2zxldvw.cloudfront.net/dist/js-gz/mcc.6dd34bb7.js.gz”> </script>
            <script type=“text/javascript” src=“https://d2k5nsl2zxldvw.cloudfront.net/dist/js-gz/currencyInfo.deb45929.js.gz”> </script>
            <script type=“text/javascript” src=“https://d2k5nsl2zxldvw.cloudfront.net/dist/js-gz/waf.4d7d0183.js.gz”> </script>
            <script type=“text/javascript” src=“https://www.expensify.com/newjs/banklist.php”> </script>
        <script type=“text/javascript”>
            hideLoading();
        </script>
            <script type=“text/javascript”>
        User.setAccountJSON( null );
        var g_account = User.getAccountJSON(); // @todo remove after refactoring
    </script>
        <script async src=“https://www.googletagmanager.com/gtag/js?id=AW-942650393”></script><script type=“text/javascript”>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag(“js”, new Date());gtag(“config”, “AW-942650393”);var _gaq=_gaq||[];_gaq.push([“_setAccount”,“UA-5524924-1”]);_gaq.push([“_setDomainName”,“[expensify.com](http://expensify.com/)”]);_gaq.push([“_trackPageview”]);(function(){var a=document.createElement(“script”);a.type=“text/javascript”;a.async=!0;a.src=(“https:“==document.location.protocol?“https://ssl/”:“http://www/”)+“.[google-analytics.com/ga.js](http://google-analytics.com/ga.js)”;var b=document.getElementsByTagName(“script”)[0];b.parentNode.insertBefore(a,b)})();</script>
    </body>
</html>
melvin-bot[bot] commented 2 years ago

Looks like something related to react-navigation may have been mentioned in this issue discussion.

As a reminder, please make sure that all proposals are not workarounds and that any and all attempt to fix the issue holistically have been made before proceeding with a solution. Proposals to change our DeprecatedCustomActions.js files should not be accepted.

Feel free to drop a note in #expensify-open-source with any questions.

luacmartins commented 2 years ago

Just adding more context - https://expensify.slack.com/archives/C01GTK53T8Q/p1660913217196589

luacmartins commented 2 years ago

Asked for help in #engineering-chat

aldo-expensify commented 2 years ago

It would probably be good to have more of the JSON revealed/logged when it fails to get parsed?

I think this is good, but maybe to avoid logging sensitive info (private chats?) we could try to do some search of non utf-8 characters and log only that? (don't know if it possible)

mallenexpensify commented 2 years ago

It just happened to me again, would logs/vid be helpful? Desktop v1.1.88-14

melvin-bot[bot] commented 2 years ago

⚠️ Looks like this issue was linked to a possible regression on PRODUCTION 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 production regression has occurred a Root Cause Analysis is required. Please follow the instructions here.

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.

melvin-bot[bot] commented 2 years ago

⚠️ 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.

luacmartins commented 2 years ago

This was solved here https://github.com/Expensify/Web-Expensify/pull/34671. Closing.

mallenexpensify commented 2 years ago

Sweet! I was able to sign out then back into desktop 15 mins ago and it's working fine so far 🤞