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
671 stars 95 forks source link

Custom function "error installing functions" via Admin Managed. Working on Local and Sideload #4571

Closed mowglimecha9 closed 2 months ago

mowglimecha9 commented 3 months ago

Provide required information needed to triage your issue

We have an admin managed add-in. Everytime we initialize it its saying "Error installing functions" We have checked everything from the functions.json to local and sideload. It works Our manifest is valid aswell

Your Environment

Expected behavior

It should show all our functions after we trigger ={NAMESPACE but nothing shows. We have a login and a taskpane that fetches apis those work. But not the custom functions.

We have done it a lot of times we push our changes and it appears. But for some reason that started yesterday night the custom functions now doesn't load. Which results to # NAME? error on our workbook.

Current behavior

It just showing us name.

Steps to reproduce

  1. Download our add-in from our admin-managed store.
  2. open excel
  3. Go to the tab and try ={Namespace} and see if it shows.

Provide additional details

Below are the logs. It stops after installing. It's not verbose enough


12/6/24 4:28:16 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:16 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.INFRA_EQUITY_COMPARABLE
12/6/24 4:28:16 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:16 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.INFRA_DEBT_COMPARABLE
12/6/24 4:28:16 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:16 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.COUNTRIES
12/6/24 4:28:16 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:16 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.TERMSTRUCTURE
12/6/24 4:28:16 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:16 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.METRICS
12/6/24 4:28:16 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success]
12/6/24 4:28:17 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin]
12/6/24 4:28:17 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:17 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.INFRA_EQUITY_COMPARABLE
12/6/24 4:28:17 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:17 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.INFRA_DEBT_COMPARABLE
12/6/24 4:28:17 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:17 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.COUNTRIES
12/6/24 4:28:17 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:17 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.TERMSTRUCTURE
12/6/24 4:28:17 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:17 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.METRICS
12/6/24 4:28:17 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success]
12/6/24 4:28:17 PM  Verbose CustomFunctions [Installation] [Addin] [Begin] Solution=78052419-ae6c-4238-8d0b-6646e790e9e0, Version=1.0.101.0
12/6/24 4:28:17 PM  Unexpected  CustomFunctions [Installation] [Addin] [End] [Failure] Solution=78052419-ae6c-4238-8d0b-6646e790e9e0, Version=1.0.101.0 

## Context
The way will be showing to our clients would be either AppSource, Admin Managed or Sideloading . As of now admin managed is not working.

## Useful logs
```12/6/24 4:28:16 PM   Verbose CustomFunctions [Metadata] [Parsing] [Begin]
12/6/24 4:28:16 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:16 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.INFRA_EQUITY_COMPARABLE
12/6/24 4:28:16 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:16 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.INFRA_DEBT_COMPARABLE
12/6/24 4:28:16 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:16 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.COUNTRIES
12/6/24 4:28:16 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:16 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.TERMSTRUCTURE
12/6/24 4:28:16 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:16 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.METRICS
12/6/24 4:28:16 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success]
12/6/24 4:28:17 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin]
12/6/24 4:28:17 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:17 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.INFRA_EQUITY_COMPARABLE
12/6/24 4:28:17 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:17 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.INFRA_DEBT_COMPARABLE
12/6/24 4:28:17 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:17 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.COUNTRIES
12/6/24 4:28:17 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:17 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.TERMSTRUCTURE
12/6/24 4:28:17 PM  Verbose CustomFunctions [Metadata] [Parsing] [Begin] Function
12/6/24 4:28:17 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success] Function=PRIVATEMETRICS.METRICS
12/6/24 4:28:17 PM  Medium  CustomFunctions [Metadata] [Parsing] [End] [Success]
12/6/24 4:28:17 PM  Verbose CustomFunctions [Installation] [Addin] [Begin] Solution=78052419-ae6c-4238-8d0b-6646e790e9e0, Version=1.0.101.0
12/6/24 4:28:17 PM  Unexpected  CustomFunctions [Installation] [Addin] [End] [Failure] Solution=78052419-ae6c-4238-8d0b-6646e790e9e0, Version=1.0.101.0```

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends. 
shanshanzheng-dev commented 3 months ago

Hi @mowglimecha9 Thanks for reporting this issue. Could you please share us the manifest? We're trying to repro and look into this issue.

mowglimecha9 commented 3 months ago

Sure. This is the manifest! @shanshanzheng-dev This is the one we uploaded in admin-managed manifest.xml.zip

shanshanzheng-dev commented 3 months ago

Hi @mowglimecha9 Thanks. We'll be looking into this issue. We'll report back if we have a suggestion for you.

mowglimecha9 commented 3 months ago

@shanshanzheng-dev Thanks for the help. We are getting ready for a release in appsource as we speak.

XuanZhouMSFT commented 3 months ago

Hi @mowglimecha9, thanks for waiting. I try to deploy the add-in you provided via Admin Managed but found it works as expeted. Below are some snapshot:

image image

So it seems it runs into some specific situation in your environment. Could you help try to clear local cache and try again? Please refer to this link: https://learn.microsoft.com/en-us/office/dev/add-ins/testing/clear-cache#manually

Also, I see the add-in is still under implementation, so I guess is it possible that you install your add-in twice(sideload and admin managed) in your environment and it causes some name conflict? If that is the case, I'd suggest you keep only 1 manifest in your environment either sideload or admin managed.

mowglimecha9 commented 3 months ago

@XuanZhouMSFT Thanks for the reply! We've tried everything and even cleared cache and also we made it so that we have one manifest.

But still getting "Error Loading functions"

XuanZhouMSFT commented 3 months ago

Sorry to hear that. We tried your add-in both in Win32 Excel(17726.20078) and MAC Excel (16.86), and they both works well. :( Could you help to provide more information for us to continue the investigation?

mowglimecha9 commented 3 months ago

We will try to upload the add-in again and check and let you know. But whats the correct way of doiing it in admin managed? should we delete and upload? or replace will do?

XuanZhouMSFT commented 3 months ago

I didn't do that before. But perhaps do a delete first and clear cache may help to avoid some cache problem?

mowglimecha9 commented 3 months ago

if [ -d ~/Library/Containers/com.Microsoft.OsfWebHost/Data/ ]; then
  rm -rf ~/Library/Containers/com.Microsoft.OsfWebHost/Data/
fi

# Additional cache locations (uncomment if needed)
rm -rf ~/Library/Containers/com.microsoft.excel/Data/Library/Caches
rm -rf ~/Library/Containers/com.microsoft.excel/Data/Library/Application\ Support/Microsoft/Office/16.0/Wef

`
We are running this command everytime we run our add-in 

This is on MAC btw
mowglimecha9 commented 3 months ago

Hi @XuanZhouMSFT i've uploaded the current manifest file in the admin managed tab. It works well but while loading the or adding the add-in through the store. Im seeing glimpse of "Error loading add-ins" in the bar below the task pane. However it will disappear after 1 sec.

Also we want to rely on admin managed than side loading the add-in thats why this is quite important. If there's a documentation why we need to clear the cache everytime that would be great as well as we are not expecting our customers to be tech savy to run a command to clear caches everytime.

XuanZhouMSFT commented 3 months ago

Hi @mowglimecha9 , the admin managed and side loading add-in are both supported. You can choose either one of them to deploy your add-in. If your customer only got the admin-managed add-in, they do not need to manually clear the cache.

In my understanding, the issue you posted in the beginning is caused by the several same add-ins deployed by both sideload and admin-managed. So if you only have 1 way to deploy your add-in, the customer will not hit it.

And also add one more information. If you already have some old files which used the add-in deployed by sideload, it will cause some problems. Because we will save the add-in location into the files. It means, in the past, you used the sideload add-in and custom function in the file, we will save the add-in information with the sideload information into the file. While you open the file again, we will rely on the saved add-in information and try to load it from sideload.

mowglimecha9 commented 3 months ago

We have submitted our app With this new xml format (sent as text file as we cannot put xml here)) upon submitting MSFT came back and said that the plugins cant be read. Its just showing #NAME this has become very frustrating now because of the back and forth. We have tested this in Windows and Mac and everything is working well. Whenever i test this in office 365 its not working also. . I wonder why because its literally same code.

privateMetrics_new.txt

XuanZhouMSFT commented 3 months ago

The #NAME most probobly caused by customer function not register well. Either resource download fail, name conflict or any other issues. From your original description, it's caused by name confliction. Even the manifest you are using or code you are using are same, but in our side, for some cases we can't do the comparation of the manifest to decide if they are the same manifest, so for some cases they will also treat them as different addin. For example, when you using different way to release like the sideload, Admin managed, or store. So, for different add-in and you are try to use the same namepsace and fucntion name, it will causes name conflict and result in register fail. So if you still encouter the issue with #NAME, the refresh button could resolve the issue. we'd like to suggest you to clear cache locally to avoid some conflict with previous status.

mowglimecha9 commented 3 months ago

But this one is from the MSFT testing team when we are trying to publish the app in the appSource. They are testing in web! and It's working in Mac and Windows. So it raises a question here on how they are doing the uploads . There are no issues on our end if we test this. Its just in MSFT approval or tester side @XuanZhouMSFT

XuanZhouMSFT commented 3 months ago

@mowglimecha9 Just want to double check with you. So the question changes, the current problem happens when you want to upload the manifest into the store? When you update the manifest and want to publish it via store. And the approve team from Microsoft have the #NAME issue when they try the add-in from Excel online?

mowglimecha9 commented 3 months ago

Yep that is correct

mowglimecha9 commented 3 months ago

@XuanZhouMSFT Hi any updates on this? Thank you

jwongyh commented 3 months ago

Hi @XuanZhouMSFT @shanshanzheng-dev @wamaina I'm assisting @mowglimecha9 on this, we are on the same team. Could we get your emails to send you the test account credentials necessary for the custom function tests.

We are encountering an issue in web browsers where we cannot retrieve the custom functions signature. While we have managed to narrow it down to custom functions not working, we are unsure of the exact cause. We suspect it may be due to the custom functions not being installed or added correctly during web browser usage - OWA.

For example, custom functions like: • =PRIVATEMETRICS.FETCHCOUNTRIES()=PRIVATEMETRICS.METRICS("PE2KBBBD","T02844") - requires account login

These functions work fine in the desktop Excel application but do not work in Excel on the web browser. How can we resolve this?

We have an open ticket for this issue:

• Request ID: 111642 • Request Title: Office add-in - Scientific Infra and Private Assets Pte Ltd - PrivateMetrics • Publisher Name: Scientific Infra and Private Assets Pte Ltd • Offer Type: Office add-in • Product/Offer Name: PrivateMetrics • Product/Offer ID: 481bb9ac-94ac-41cc-adfe-ba1fa3eb1fcf • Policy Number Requiring Assistance: 1120.3.2.2 Online Chrome • Request Details: The add in did not pass compatibility test for the excel online. However the errors described are working when using an offline excel. How can this be resolved?

We have included the video clip for the issue in the zip file and the repro steps here.

Content requirement - 1120.3.2.2 Online Chrome Repro Steps: • Open Excel • Load the add-in • Enter credentials to login. • Noticed that no CF are there and also getting #NAME as output while running any query.

Certification Failure report: https://partner.microsoft.com/en-us/dashboard/office/products/481bb9ac-94ac-41cc-adfe-ba1fa3eb1fcf/certification/reports/114e6972-f9dc-4ebe-9020-2bcc704e3120

cert-report.zip

XuanZhouMSFT commented 2 months ago

@jwongyh Thanks for the waiting. Based on my previous understanding, the add-in in your local environments could be work well both in desktop and online. The only problem is verification if not pass while you upload the manifest to the store. If that's the case, you need to communicate in the store upload platform. BTW, I did a quick local test in online and found an error saying below. Could you help to do a double check from your server. image

mowglimecha9 commented 2 months ago

Hi @XuanZhouMSFT and team.

We can close this ticket now. It turns out the problem was a CORS policy in our s3 bucket. Thanks so much for the help!