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
670 stars 96 forks source link

"Something went wrong" errors began surfacing recently while using the add-in - bisect does not help, we suspect an Excel for the Web issue #1768

Closed wh1t3cAt1k closed 3 years ago

wh1t3cAt1k commented 3 years ago

Problem: files using our add-in, opened in Chromium-based browsers in Excel Online, started exhibiting numerous and frequent non-descriptive "something went wrong" errors during recalculation, making the add-in unusable in many cases.

The error is sporadic but its frequency seems correlated to the number of cells using our custom functions in the file.

The add-in is called Velixo if it's required.

At first, I suspected a regression in our code. However, bisecting proved unfruitful and even older revisions of the add-in, which used to work just fine in production, are now SWW'ing like crazy when we check out those revisions locally.

Sample Error Ids:

2450e54e-d897-426e-8bfd-582588d810d3, 2021-03-31 14:51:28Z Happened on session id 4b5b40c3-1203-4080-b2f6-94785c7d13ef and build 16.0.13921.31876 Browser: Edge Version 89.0.774.63 (Official build) (64-bit)

An ID of an earlier error: 5aa5b21b-ea25-488a-aa14-42a01f9072d2, 2021-03-30 12:38:13Z

(do you have telemetry to check where those errors originated?)

Setup:

We don't really understand what is going on, however we have some anecdotal evidence that the errors began surfacing after this feature had been announced: https://insider.office.com/en-us/blog/collaborate-with-confidence-with-show-changes-in-excel-web?ocid=usoc_TWITTER_M365_spl100001892525966 . Does that build 16.0.13921.31876 even have this feature?

Your Environment

wh1t3cAt1k commented 3 years ago

Another error instance occurred just now on the same set-up (Edge Chromium).

This time, I replaced all my custom function definitions with

await Promise.resolve();
return 42;

Error Id: 0a2fbefb-becc-4be9-b426-60d75694d48c, 2021-03-31 18:51:54Z

wh1t3cAt1k commented 3 years ago

More experiments: this time, I threw off the Redux store, sagas, epics, the UI – everything.

I left just an h1 with an onClick handler that awaits Office.onReady() and then invokes Excel.run() to do just one operation: context.workbook.application.calculate('Full') .

That's it.

Enough clicks at this h1 (sometimes up to twenty, diligently waiting for the previous calculation to end) and here goes "something went wrong".

Error Id: 595d7711-d064-42b3-805d-73382a73ee9a, 2021-03-31 19:01:22Z

TLDR:

Eventually we hit this error for no apparent reason - the debugger does not stop on, or log, any promise rejections.

Rick-Kirkham commented 3 years ago

@lumine2008 and @grangeryy can you please take a look at this?

wh1t3cAt1k commented 3 years ago

Thanks for the prompt response @Rick-Kirkham , I appreciate your speed guys :)

On my end, I seem to have a pretty minimal set-up of an add-in that reproduces the issue.

My index file:

require('../functions/functions');

import '@fluentui/react/dist/css/fabric.min.css';
import React from 'react';
import ReactDOM from 'react-dom';
import { App } from './components/app/app';

ReactDOM.render(<App />, document.getElementById('container'));

App component:

import { ExcelRecalculationService } from 'packages/addin/src/services/excel-interop/excel-recalculation-service';
import React from 'react';

const App: React.FunctionComponent = () => (
    <div>
        <h1
            onClick={async (): Promise<void> => {
                await ExcelRecalculationService.recalculateFull();
            }}
        >
            CLICK ME TO GET FRUSTRATED.
        </h1>
    </div>
);

export { App };

Excel recalculation service:

export class ExcelRecalculationService {
    public static readonly recalculateFull = async (): Promise<void> => {
        await Office.onReady();

        return Excel.run(
            async (context): Promise<void> => {
                context.workbook.application.calculate('Full');
                await context.sync();
            }
        );
    };
}

and, finally, my stubbed out custom function definitions (functions.ts imported from index - we are using shared runtime):

import { CustomFunctionIdentifier } from './custom-function-identifier';

const queueFunctionCall = async <TResult>(): Promise<TResult> => {
    await Promise.resolve();
    return 42 as never;
};

Object.keys(CustomFunctionIdentifier).forEach(name => {
    CustomFunctions.associate(name, async () => queueFunctionCall());
});

The key seems to be having maaaaany custom function cells in the file, ideally with some dependent diagrams and such.

lumine2008 commented 3 years ago

This issue looks like related to webview, It doesn't seem related to Excel JS API @Rick-Kirkham, would you please also loop contact from web view?

wh1t3cAt1k commented 3 years ago

Thanks @lumine2008 @Rick-Kirkham , please keep us posted. The issue does not seem transient, I encountered it again many times last week.

Rick-Kirkham commented 3 years ago

@smaremanda @jeremy-msft Can you find someone who can help with this?

grangeryy commented 3 years ago

Bug 5026687 is created to track this issue and we'll investigate soon.

xiaochunms commented 3 years ago

@wh1t3cAt1k Not sure if you are still hitting the error as such. If so, may you please share the latest Error Id? The previous Error Id was out of date and a latest one will be much helpful for the investigation. Sorry about that and thanks a lot for your understanding.

ghost commented 3 years ago

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

wh1t3cAt1k commented 3 years ago

Hi guys,

We haven't observed this error recently. Not sure what it was. Thanks!

On Sat, Aug 7, 2021, 12:00 msftbot[bot] @.***> wrote:

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OfficeDev/office-js/issues/1768#issuecomment-894627583, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHLV3RDCCTJRGVSWCOHT6DT3TY35ANCNFSM42E4ABKA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

grangeryy commented 3 years ago

@wh1t3cAt1k thanks for the info! Will close the issue for temporary and feel free to reopen it once the error shows up again.