OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
663 stars 94 forks source link

Outlook: In Web and new Outlook desktop OnMessageCompose event not triggering after sending several emails #4525

Open ArkaiAriza opened 2 months ago

ArkaiAriza commented 2 months ago

After sending several emails in a row, OnMessageCompose event stops truggering

Your Environment

Expected behavior

On composing a message OnMessageCompose event should trigger and its assigned hanlder should run.

Current behavior

After sending several emails (~15) OnMessageCompose event doesn't trigger and its handler doesn't run. Looking in the network tab it seems that the relevant addin files are not being requested.

Steps to reproduce

  1. Have an addin with OnMessageCompose launch event configured and a handler with some easy to check logic.
  2. Compose a new email. Check if the handler is running. Additionally in the network tab check if the relevant addin files are being requested.
  3. If all is good, send the email.
  4. Repeat steps 2 and 3 until the handler doesn't run. Usually takes 15 emails. Sometimes as high as 25.
  5. Once the handler doesn't run once, it won't run anymore until you reload the page. You can also check that the addin files are not being requested.

Link to live example(s)

Don't have live example. I'm able to reproduce this issue with this very simple addin https://github.com/ArkaiAriza/outlook-sample It has an OnMessageCompose handler that logs "preprocess" to the console, and an OnMessageSend handler that logs "sending" to the console. After sending several messages (~15) the "preprocess" stops logging (it also stops fetching the relevant addin files) but "sending" keeps logging when you send.

Context

We need our addin to run for every email. If it stops running after sending several emails our use case is severely affected. This is also affecting New Outlook on Windows desktop

Useful logs

No particualr error arise in this case.

akagarwa-msft commented 2 months ago

We tried reproing the issue with our test add-in and the add-in you have provided but it doesn't repro for us at all. can you please share a repro video to understand the issue better.

ArkaiAriza commented 2 months ago

Hi. I'm currently trying to provide a video of the issue.

ArkaiAriza commented 2 months ago

@akagarwa-msft Hi. I had some problems reproducing the issue with the sample, even though I was able to reproduce it fairly easily last week. The issue still presented in our production environment so I kept digging.

The change that made it fail again was adding the OnMessageRecipientsChanged event and a corresponding handler. I have updated the provided sample to reflect this, and I recorded a video of the issue. Please tell me if you have problems with the video or if you need anything else.

Thank you very much for your attention.

ArkaiAriza commented 2 months ago

Update: We removed these events from our app as a temporary measure. Right now it's working well with only OnMessageCompose and OnMessageSend events. Any update on the state of this functionality? We are working our way around not using the other events but it would be great to use them again.

butterpunk commented 2 months ago

@akagarwa-msft any luck here?

mobisw-msft commented 2 months ago

@butterpunk , @ArkaiAriza , Apologies for the delay. We are investigating this issue, and we will keep this thread posted.

mobisw-msft commented 2 months ago

Hey @butterpunk , @ArkaiAriza ,

Thank you for reporting the issue with OnMessageCompose and OnRecipientsChange not firing after a certain number of calls. This has been put in our backlog. Unfortunately, we have no timelines to share at this point.

Internal tracking ID: 4623248

butterpunk commented 2 months ago

Thank you @mobisw-msft.

This is very important to us because our customers rely on those events, and send many emails in repetition. This makes it very likely that they'll get into this state and will get their email service disrupted by the "add-in taking too long with your request" modal.