OfficeDev / office-js

A repository for issues related to the Office JavaScript APIs and Office Add-ins platform. Find the Office.js library in Office.js CDN: https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
725 stars 106 forks source link

Add-in failed to install or load custom functions. #5511

Open marenac4 opened 1 month ago

marenac4 commented 1 month ago

Error installing functions

We are developing an Excel add-in featuring a Task Pane and custom functions. During the development phase, we sideloaded the add-in without any issues. However, after publishing it on the Microsoft 365 Admin Center and subsequently on AppSource, users have reported encountering the error "Error installing functions" when using the add-in on the web, regardless of whether it was obtained from the Admin Center or AppSource.

Image

Occasionally, our custom functions fail to load, resulting in a #NAME? error in the cells. Image

Your Environment

Expected behavior

We are expecting custom functions to install and load every time on the web excel when our add-in is installed via AppSource. And not to see an error.

Current behavior

We do see error Error installing functions, and time to time our functions do not load, so we get #NAME? in the cell when calling our functions.

Steps to reproduce

  1. Open excel on the web.
  2. Install our add in cmdtyView
  3. If error does not occur immediately, refresh the page and you will be able to see error.
  4. Try entering one of our functions. For example =cmdty.udfs.BCF_LAST(string)
github-actions[bot] commented 1 month ago

Here are some similar issues that might help you. Please check if they can solve your problem.

Possible solution (Extracted from existing issue, might be incorrect; please verify carefully)

Solution 1:

Clearing the Office cache can resolve the issue. Users have reported that clearing the cache from specific locations on their machines fixed the problem. For example, on Mac, clearing the cache from '~/Library/Containers/Microsoft Excel/Data/Library/Application Support/Microsoft/Office/16.0/Wef/' and '~/Library/Containers/Microsoft Excel/Data/Library/Caches/' resolved the issue.

Reference:

Reference:

Reference:

Powered by issue-sentinel

marenac4 commented 1 month ago

Thank you for your recommendations. Before opening this issue, we thoroughly reviewed similar known issues but unfortunately didn’t find a solution that works for us.

I’d also like to highlight that the described issue occurs on both new machines (installing our add-in for the first time) and development machines.

As for the third solution, we believe it does not apply in our case. We previously encountered a similar problem after deploying the add-in code to the server, but that issue was also present when sideloading.

guoms1 commented 1 month ago

Hi, @marenac4

Thanks for reporting the issue.

I tried to reproduce the problem, but it looks like your add-in requires a login, and I’m unable to proceed without valid credentials.

If possible, could you please share a test account we can use for investigation? You can send the credentials to the following one-time email address: adelev@M365x13055881.onmicrosoft.com. I’ll check it within the next couple of days, but please note that I won’t be monitoring it afterward.

Appreciate your help!

Best regards,

marenac4 commented 1 month ago

Hello @guoms1,

Thank you for your response.

I have sent the test accounts to the email you provided. However, an account is not required to reproduce our issue. You can simply check whether one of our functions is available, for example: =cmdty.udfs.BCF_LAST(string).

If you need any additional information, please don't hesitate to ask.

Thank you.

guoms1 commented 1 month ago

Hi, @marenac4

Thank you again for the detailed description and for providing test accounts—we really appreciate your collaboration.

After discussing this issue with our domain expert, we’ve gathered a few thoughts and suggestions that might help us move forward:

  1. We haven’t seen similar reports from other customers, and given that the issue is not consistently reproducible on our side either, we currently lean toward this being a usage- or environment-specific issue.
  2. Since the issue appears on Excel for the Web, could you let us know if it also occurs in Excel Desktop? This would help determine if the issue is platform-specific.
  3. For the web environment, we recommend clearing your browser cache and then retrying. If the error reappears, please open the browser DevTools and check for any relevant errors in the Console or Network tab—this information could be very helpful for our investigation.
  4. We also suggest adding more diagnostic logging within your function code to help narrow down the failure point.
  5. One key observation is that sideloading works reliably, while issues tend to occur only after deploying via the Admin Center or AppSource. This suggests that differences in the deployment environment—such as manifest settings, server latency, or load sequence—may be contributing factors.
    • For instance, in a sideloaded scenario, your custom functions are likely being served from a local development server, whereas published versions are loaded from remote servers, which may introduce additional latency or timing differences. These can result in intermittent race conditions.
    • Additionally, please note that the firing of Office.onReady() does not guarantee that custom functions have finished installing. If any logic assumes custom functions are ready immediately after onReady, that could lead to inconsistent behavior—especially in environments where network delays are higher.
    • As an example of such environment-driven issues, things like CORS misconfigurations may also lead to failures during the loading process. While we’re not suggesting CORS is the root cause in this case (especially since the issue isn’t consistently reproducible), it serves to illustrate how subtle differences in setup can lead to different outcomes across environments.
  6. To proceed with an effective investigation, we’ll need either a reliable repro scenario or, in the case of Excel for the Web, at least a session ID from a minimal repro case. This will help us target the issue more precisely.

Please let us know if you’re able to gather any of the above, and we’ll continue working closely with you to resolve this issue.

Best regards,

marenac4 commented 1 month ago

@guoms1, thanks again for your collaboration.

The key details are as follows:

Reproducibility:

Manifest Details:

Console Logs:

Further Investigation & Testing:

Meanwhile, I am working on creating a minimal reproducible example that excludes any confidential data.

Looking forward to your insights!

linderholm commented 3 weeks ago
  • Additionally, please note that the firing of Office.onReady() does not guarantee that custom functions have finished installing. If any logic assumes custom functions are ready immediately after onReady, that could lead to inconsistent behavior—especially in environments where network delays are higher.

@guoms1 What is the correct approach then? I.e is there anything I can await to ensure functions have finished installing?