App icon indicating copy to clipboard operation
App copied to clipboard

Clicking on an image in the email I received leads to a "Hmm... it's not here" page.

Open m-natarajan opened this issue 1 year ago • 7 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.73-0 Reproducible in staging?: Y Reproducible in production?: N If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: 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: @davidcardoza Slack conversation (hyperlinked to channel name): #quality

Action Performed:

  1. Send an image as user A to user B while user B is offline
  2. As user B, click image in email summary

Expected Result:

The image displayed without any issue

Actual Result:

hmm... it's not here message displayed

Workaround:

Unknown

Platforms:

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

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/3cd8c63b-c1fa-4af2-b903-70551fe1a429

https://github.com/user-attachments/assets/ed7822c1-3571-488a-99f5-ceb65322177e

View all open jobs on GitHub

m-natarajan avatar Dec 09 '24 18:12 m-natarajan

Triggered auto assignment to @JmillsExpensify (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[bot] avatar Dec 09 '24 18:12 melvin-bot[bot]

Triggered auto assignment to @mjasikowski (AutoAssignerNewDotQuality)

melvin-bot[bot] avatar Dec 09 '24 18:12 melvin-bot[bot]

Triggered auto assignment to @dangrous (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

melvin-bot[bot] avatar Dec 09 '24 18:12 melvin-bot[bot]

💬 A slack conversation has been started in #expensify-open-source

melvin-bot[bot] avatar Dec 09 '24 18:12 melvin-bot[bot]

:wave: 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.

github-actions[bot] avatar Dec 09 '24 18:12 github-actions[bot]

This also happens in prod. Demoting to NAB.

luacmartins avatar Dec 09 '24 20:12 luacmartins

Hm this feels like it might be backend, but definitely open to a front end solve if we have one! Will look shortly

dangrous avatar Dec 09 '24 21:12 dangrous

Trying to replicate locally, apparently it's hard to get the email summaries to send.

dangrous avatar Dec 10 '24 17:12 dangrous

Trying to get some help replicating this, once i can we can figure out the solution

dangrous avatar Dec 12 '24 16:12 dangrous

Okay so I managed to reproduce finally. The issue looks like the formation of the link from the email, vs. how you get there from the app itself. I don't yet know exactly which parts are causing the biggest issues, but here's the details.

Link from email:

https://dev.new.expensify.com:8082/r/3058871422043474/attachment?source=https%3A%2F%2Fwww.expensify.com.dev%2Fchat-attachments%2F5094796852905002131%2Fw_53497515bb3b313ac8e88c4efded655601d91524.png

URL from navigating in App:

https://dev.new.expensify.com:8082/attachment?source=https%3A%2F%2Fexpensify-dgalerosen.ngrok.io%2Fchat-attachments%2F5094796852905002131%2Fw_53497515bb3b313ac8e88c4efded655601d91524.png&type=r&reportID=3058871422043474&isAuthTokenRequired=true&fileName=Screenshot_2024-12-10_at_12.27.42.png

Differences:

https://dev.new.expensify.com:8082
**[EMAIL LINK HAS /r/<reportID>]**
/attachment?source=
[EMAIL HAS OLD DOT LINK, URL HAS NEW]
chat-attachments%2F5094796852905002131%2Fw_53497515bb3b313ac8e88c4efded655601d91524.png
[URL HAS &type=r&reportID=3058871422043474&isAuthTokenRequired=true&fileName=Screenshot_2024-12-10_at_12.27.42.png]

Playing around, I think a few things are happening:

  • The report needs to be passed as a URL param, NOT as part of the url
  • Possibly, the source needs to be a newdot link, though I'm not sure about that
  • fileName and isAuthTokenRequired seem to possibly not be required, though that seems odd on the latter front.
  • I'm not sure about type

The nice thing is that it's consistent, it's not about whether or not the user has access to the particular report or attachment or whatever. That is, after I successfully open it, the email link still doesn't work. So it should be easy to reproduce / update that link once I find the logic.

dangrous avatar Dec 12 '24 19:12 dangrous

hey @Gonals it looks like you wrote the initial URL that we use for attachment email links (here). any ideas on why these aren't working anymore?

dangrous avatar Dec 12 '24 19:12 dangrous

That was a while ago, but it seems we have changed the URLs in Newdot?

Gonals avatar Dec 13 '24 11:12 Gonals

Yeah hrm. Okay so I've got nearly all of what we need. I've updated the backend to use the right format:

URL_TO_NEW_DOT.'attachment?source='.$url.'&type=r&reportID='.$reportID;

This works on dev! Yay! However, I looked into production a little bit and I'm not 100% sure it will solve the problem. I found a recent image from the social channel. The link I received in my email (which doesn't work) was

https://new.expensify.com/r/6549335221793525/attachment?source=https://www.expensify.com/chat-attachments/1994588430180453104/w_ab9f5e72faca59f0bc1888e27f087a52d683bf6b.jpg

Adapting that into what my updated backend will send, we'll get:

https://new.expensify.com/attachment?source=https://www.expensify.com/chat-attachments/1994588430180453104/w_ab9f5e72faca59f0bc1888e27f087a52d683bf6b.jpg&type=r&reportID=6549335221793525

Unfortunately, that still doesn't work. Let's keep going.

The link that actually works, via App, is

https://new.expensify.com/attachment?source=https%3A%2F%2Fwww.expensify.com%2Fchat-attachments%2F7162688893835784434%2Fw_c622099d5dc912677747f0b1d9b2b0d91da26598.jpg&type=r&reportID=6549335221793525&isAuthTokenRequired=true&fileName=7594B93F-3659-4022-95AF-05728EADA518.jpg

Adapting that into the same format from my change, it still works like this:

https://new.expensify.com/attachment?source=https://www.expensify.com/chat-attachments/7162688893835784434/w_c622099d5dc912677747f0b1d9b2b0d91da26598.jpg&type=r&reportID=6549335221793525

At this point, we're at exactly the same link [format] as my new format. But it looks like the email link still wouldn't work, even with the changes - because the reportActionID (I assume that's what the numbers after chat-attachments are?) and the file name (w_....) are different.

I'm hoping that's unrelated, and it might work if we push this change? I'm heartened by it working on dev... but that's definitely peculiar.

dangrous avatar Dec 13 '24 17:12 dangrous

BE fix that should hopefully fix this is merged, not yet deployed

dangrous avatar Dec 16 '24 13:12 dangrous

Okay it did not fix it, I'm waiting to get a new image link so I can try to identify what else we can try.

dangrous avatar Dec 18 '24 19:12 dangrous

@dangrous want me to send you an image? Don't open the DM so it will ship to your email.

davidcardoza avatar Dec 18 '24 22:12 davidcardoza

that would be great @davidcardoza ! I just tried sending myself one from my expensifail account but it didn't come through, even after way more than 10 minutes... maybe yours will work

dangrous avatar Dec 19 '24 21:12 dangrous

Sent a pic over via DM, it's a beaut.

davidcardoza avatar Dec 20 '24 03:12 davidcardoza

So in that testing ^ it DID work as expected. Do you think we should have QA re-test this one more time?

I'll also send you one @davidcardoza for another local test.

dangrous avatar Dec 20 '24 20:12 dangrous

Okay so it seems to work MORE of the time now, but not all the time.

  • David -> Daniel worked!
  • Daniel -> David worked!
  • Another David -> Daniel didn't work on first click, but did on second.
  • Another photo I happened to see come through worked!

I... am not sure what to do with that info haha. We're batting .750-1.000 but not certain it's enough. What do we think?

dangrous avatar Dec 20 '24 22:12 dangrous

@JmillsExpensify @mjasikowski @dangrous 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!

melvin-bot[bot] avatar Dec 23 '24 09:12 melvin-bot[bot]

@JmillsExpensify, @mjasikowski, @dangrous Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Dec 24 '24 09:12 melvin-bot[bot]

@JmillsExpensify, @mjasikowski, @dangrous Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Dec 26 '24 09:12 melvin-bot[bot]

@JmillsExpensify, @mjasikowski, @dangrous 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

melvin-bot[bot] avatar Dec 30 '24 09:12 melvin-bot[bot]

@JmillsExpensify, @mjasikowski, @dangrous 10 days overdue. Is anyone even seeing these? Hello?

melvin-bot[bot] avatar Jan 01 '25 09:01 melvin-bot[bot]

@dangrous any updates here? Melvin is getting anxious

mjasikowski avatar Jan 02 '25 11:01 mjasikowski

@JmillsExpensify, @mjasikowski, @dangrous Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Jan 06 '25 09:01 melvin-bot[bot]

oops hi, was on break for the holidays. In further testing, this still doesn't work reliably. I've got some more images that were sent in social, so I'm going to try to investigate them further and see what I can do

dangrous avatar Jan 06 '25 18:01 dangrous

Okay so I noticed a couple things:

  • All image links in emails direct to new.expensify.com. However, in the URL query the source param of the image is either www.expensify.com or staging.expensify.com. My guess is this is due to which platform the user uploaded the image on. However, if these don't match, the link doesn't work. prod and prod works, stag and stag works, but not a mix. So we should probably force the source link to be prod.
  • Weirdly, when you click on a link like https://new.expensify.com/attachment?source=https://www.expensify.com/chat-attachments/4324233214072273054/w_786e7a0caedb4e522f56c6b328a1f1b8f88be853.jpg&type=r&reportID=6549335221793525 , when the URL resolves in the browser the source is https:/www.expensify... - it loses one of the slashes. I haven't figured out why this is yet. It happens on both staging and prod urls.
  • The source of in-app links are always URL encoded, but that seems separated from whether or not the links work. decoded good links are still good, encoded bad links are still bad.
  • The links clicked in app always have &isAuthTokenRequired=true&fileName=[whatever].png at the end but I'm pretty sure that it's not really necessary? it's hard to tell since there's so much else going on.
  • Lastly, it's so weird that it sometimes works now. It seems to be more often NOT in #social, but that doesn't really help. Still, sometimes is better than none of the time?

Sooo.. not really closer but at least we have some threads to pull on? I should probably try to figure out on the other side what happens - like when the app gets a deep link to an image, how does it parse it and what is it looking for. Rather than just looking to make them match exactly.

Side note: do we care that email links are always prod? What if you're logged in on staging and not prod? I guess it's mostly an internal question.

dangrous avatar Jan 06 '25 19:01 dangrous

So good news - I've figured out how to get the file token and the authtoken required in the attachment link; bad news is it doesn't help. Asking for some help in Slack to point me towards where we handle these deeplinks in App so I can see if there's anything I can do on that side.

dangrous avatar Jan 07 '25 20:01 dangrous