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.56k stars 2.9k forks source link

"you don't have access to this room" error message displayed when group chat thread opened #50731

Open m-natarajan opened 1 month ago

m-natarajan commented 1 month 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!


Version Number: Reproducible in staging?: Needs Reproduction Reproducible in production?: Needs Reproduction 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: @puneetlath Slack conversation: https://expensify.slack.com/archives/C05LX9D6E07/p1728661697974329

Action Performed:

  1. Go to staging.new.expensify.com
  2. Open a group chat where you are a member

    Expected Result:

    User able to enter message in group chat and no error displayed

    Actual Result:

    The API returned a "you don't have access to this room" error and worked when commented again

    Workaround:

    Unknown

    Platforms:

    Which of our officially supported platforms is this issue occurring on?

    • [ ] Android: Native
    • [ ] Android: mWeb Chrome
    • [ ] iOS: Native
    • [ ] iOS: mWeb Safari
    • [x] MacOS: Chrome / Safari
    • [ ] MacOS: Desktop

Screenshots/Videos

image (2)

Add Comment API response that failed:

{ "code": 666, "jsonCode": 666, "type": "Expensify\\Libs\\Error\\ExpError", "UUID": "E490CD6D-46BF-4EE2-8B4F-51672557284A", "message": "You don't have access to this chat room.", "title": "Room not accessible", "data": { "onyxData": [ { "onyxMethod": "merge", "key": "reportActions_3634649718846583", "value": { "93999890068247772": { "errors": { "1728661529553049": "You don't have access to this chat room." } } } } ] }, "htmlMessage": "", "onyxData": [ { "onyxMethod": "merge", "key": "reportActions_3634649718846583", "value": { "93999890068247772": { "errors": { "1728661529553049": "You don't have access to this chat room." } } } } ], "requestID": "8d0ffa3e99af0f6b-EWR" }

Second one that succeeded:

{ "jsonCode": 200, "requestID": "8d0ffaa84b0d0f6b-EWR", "onyxData": [ { "key": "report_3634649718846583", "onyxMethod": "merge", "value": { "participants": { "2697693": { "hidden": false, "notificationPreference": "always", "role": "admin" }, "778531": { "hidden": true, "notificationPreference": "hidden", "role": "member" } } } }, { "key": "report_3634649718846583", "onyxMethod": "merge", "value": { "chatType": "group", "description": "", "lastActorAccountID": 778531, "lastMessageText": "firebase crash reports", "lastVisibleActionCreated": "2024-10-11 15:45:46.526", "managerID": null, "ownerAccountID": 0, "parentReportActionID": "451061726100912230", "parentReportID": "4160486413986541", "policyID": "_FAKE_", "reportID": "3634649718846583", "reportName": "THREAD Protect App Quality", "state": "OPEN", "stateNum": 0, "statusNum": 0, "type": "chat", "visibility": null } }, { "key": "reportActions_3634649718846583", "onyxMethod": "merge", "shouldShowPushNotification": true, "value": { "5311850144429338368": { "actionName": "ADDCOMMENT", "actorAccountID": 778531, "avatar": "https:\/\/d1wpcgnaa73g0y.cloudfront.net\/36e397299365c36a787b6084a641bd2fe1b28a58_128.jpeg", "created": "2024-10-11 15:45:46.526", "lastModified": "2024-10-11 15:45:46.526", "message": [ { "html": "firebase crash reports", "text": "firebase crash reports", "type": "COMMENT", "whisperedTo": [] } ], "originalMessage": { "html": "firebase crash reports", "isNewDot": true, "lastModified": "2024-10-11 15:45:46.526" }, "person": [ { "style": "strong", "text": "Puneet Lath", "type": "TEXT" } ], "reportActionID": "5311850144429338368", "shouldShow": true } } }, { "key": "personalDetailsList", "onyxMethod": "merge", "value": { "778531": { "accountID": 778531, "avatar": "https:\/\/d1wpcgnaa73g0y.cloudfront.net\/36e397299365c36a787b6084a641bd2fe1b28a58_128.jpeg", "displayName": "Puneet Lath", "firstName": "Puneet", "lastName": "Lath", "login": "puneet@expensify.com", "phoneNumber": "", "pronouns": "__predefined_heHimHis", "status": null, "timezone": { "automatic": true, "selected": "America\/New_York" }, "validated": true } } }, { "key": "reportActions_4160486413986541", "onyxMethod": "merge", "value": { "451061726100912230": { "childCommenterCount": 2, "childLastActorAccountID": null, "childLastMoneyRequestComment": null, "childLastReceiptTransactionIDs": null, "childLastVisibleActionCreated": "2024-10-11 15:45:46.526", "childMoneyRequestCount": null, "childOldestFourAccountIDs": "2697693,778531", "childRecentReceiptTransactionIDs": null, "childReportNotificationPreference": "hidden", "childStateNum": 0, "childStatusNum": 0, "childType": "chat", "childVisibleActionCount": 2 } } }, { "key": "report_3634649718846583", "onyxMethod": "merge", "value": { "notificationPreference": "always", "participants": { "778531": { "hidden": false, "notificationPreference": "always" } } } }, { "key": "reportActions_4160486413986541", "onyxMethod": "merge", "value": { "451061726100912230": { "childReportNotificationPreference": "always" } } }, { "key": "report_3634649718846583", "onyxMethod": "merge", "value": { "participants": { "2697693": { "hidden": false, "notificationPreference": "always", "role": "admin" }, "778531": { "hidden": false, "notificationPreference": "always", "role": "member" } } } }, { "key": "report_3634649718846583", "onyxMethod": "merge", "value": { "lastReadTime": "2024-10-11 15:45:46.526" } } ], "previousUpdateID": 2368467387, "lastUpdateID": 2368473805 }

Add any screenshot/video evidence

View all open jobs on GitHub

melvin-bot[bot] commented 1 month ago

Triggered auto assignment to @MonilBhavsar (AutoAssignerNewDotQuality)

melvin-bot[bot] commented 1 month ago

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

MelvinBot commented 1 month ago

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

muttmuure commented 1 month ago

@pasyukevich is this the same issue that you investigated before?

muttmuure commented 1 month ago

Dupe? https://expensify.slack.com/archives/C05LX9D6E07/p1725570547077669

pasyukevich commented 1 month ago

@muttmuure looks very similar

CortneyOfstad commented 1 month ago

I am not able to recreate. @muttmuure @pasyukevich @puneetlath — are you all able to recreate this?

muttmuure commented 1 month ago

https://github.com/Expensify/App/issues/48746

muttmuure commented 1 month ago

@pasyukevich do you mind checking if this has the same root cause, since you have context from the linked issue?

CortneyOfstad commented 1 month ago

@muttmuure I am heading OoO shortly (until 10/23) — would you be willing to keep an eye on this while I am out?

pasyukevich commented 1 month ago

sure, I'm taking a look

pasyukevich commented 1 month ago

I was able to recreate the issue

image
pasyukevich commented 1 month ago

This issue is quite different.

Logs are different from other similar issue. From this side, all looks good.

The problem for me looks like the BE issue - from the network tab I've inspected the request body and noticed that the difference between successful and rejected requests is minor. (key, time, and text itself)

pasyukevich commented 1 month ago

How I was able to reproduce after a few iterations:

  1. Open the app with different two logged accounts (from two different browsers on stage or the same but one from the incognito)
  2. Create a workspace where there will be both of them
  3. Enable 3g mode on both browsers from the network tab
  4. Send message from the account A to the workspace
  5. Once it shows for another user immediately send a few messages to the thread of the new message
  6. Observe the error
MonilBhavsar commented 1 month ago

Tried following this but could not repro.

https://github.com/user-attachments/assets/51d4d0d4-550b-4527-aa20-c95561da5f2b

I sus what's happening theoretically is - OpenReport is not finishing somehow and concurrently we queue an AddComment. At that time, report is not shared yet and hence we could not AddComment and see the error

MonilBhavsar commented 1 month ago

I thought blocking commit queue could be the reason for delay in processing OpenReport command, so tried on staging too, but no dice.

If anyone is able to reproduce please share the requestID of the OpenReport command that is triggered when opening the thread. Happy to look at the logs

pasyukevich commented 1 month ago

@MonilBhavsar I have this from yesterday - reportID 1005955096101416

image

I will try to reproduce it today and share the requestID

MonilBhavsar commented 1 month ago

I can take a look tomorrow, thanks. Is emailID of user A - slipway_cornice_01@icloud.com?

pasyukevich commented 1 month ago

Yes, it is correct

MonilBhavsar commented 4 weeks ago

The emailID has 0l and not 01. I spent some time investigating why logs are not showing up :trollface:

AddComment logs that failed https://www.expensify.com/_devportal/tools/logSearch/#sort=asc&size=10000&query=blob%3A%22AddComment%22%20AND%20blob%3A%22404%20Report%20not%20found.%22%20AND%20email%3A%2202trim-signing%40icloud.com%22%20AND%20timestamp%3A%5B2024-10-14T00%3A00%20TO%202024-10-17T23%3A59%5D

There are no OpenReports logs that explains when report was created and shared, so going to run a query

MonilBhavsar commented 3 weeks ago

The thread reportID 1005955096101416 was created and shared on 2024-10-16 14:36:20 The attempts to AddComment that failed happened on 2024-10-16 14:36:26, 2024-10-16 14:36:28 and 2024-10-16 14:36:30

Definitely not the race condition situation. The report was created and shared already while user attempted to add a comment.

MonilBhavsar commented 3 weeks ago

Discussing in thread https://expensify.slack.com/archives/C05LX9D6E07/p1728661697974329

CortneyOfstad commented 3 weeks ago

Back from OoO — thanks @MonilBhavsar for keeping this moving!

MonilBhavsar commented 3 weeks ago

Going to ask in #engineering chat

muttmuure commented 3 weeks ago

Heads up! I am moving Group Chat and Thread bugs to MEDIUM priority as part of this thread.

This might change, in which case I will change it back

melvin-bot[bot] commented 3 weeks ago

@puneetlath @CortneyOfstad @MonilBhavsar this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

CortneyOfstad commented 3 weeks ago

Thanks @MonilBhavsar and @muttmuure!

MonilBhavsar commented 2 weeks ago

Thanks! Will discuss here https://expensify.slack.com/archives/C03TQ48KC/p1730277368993379

MonilBhavsar commented 2 weeks ago

Will bump the thread

CortneyOfstad commented 2 weeks ago

Thanks @MonilBhavsar!

MonilBhavsar commented 1 week ago

Latest discussion https://expensify.slack.com/archives/C03TQ48KC/p1731060862097899?thread_ts=1730825360.442359&cid=C03TQ48KC

MonilBhavsar commented 1 week ago

Same^

MonilBhavsar commented 5 days ago

Need to post proposal to #engineering-chat. Will try to do it tomorrow

melvin-bot[bot] commented 1 day ago

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