OfficeDev / generator-office

Yeoman generator for building Microsoft Office related projects.
https://www.npmjs.com/package/generator-office
MIT License
836 stars 208 forks source link

UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token in JSON at position 3324 #599

Closed xstos closed 3 years ago

xstos commented 3 years ago

Prerequisites

Expected behavior

The generator demo should work

Current behavior

 yo office

     _-----_     ╭──────────────────────────╮
    |       |    │   Welcome to the Office  │
    |--(o)--|    │   Add-in generator, by   │
   `---------´   │ @OfficeDev! Let's create │
    ( _´U`_ )    │    a project together!   │
    /___A___\   /╰──────────────────────────╯
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

? Choose a project type: Office Add-in Task Pane project supporting single sign-on
? Choose a script type: JavaScript
? What do you want to name your add-in? SSO365
? Which Office client application would you like to support? Word

----------------------------------------------------------------------------------

      Creating SSO365 add-in for Word using JavaScript and Single-sign-on at C:\SSO365

----------------------------------------------------------------------------------

      Congratulations! Your add-in has been created! Your next steps:

      1. Go the directory where your project was created:

         cd C:\SSO365

      2. Configure your SSO taskpane add-in:

         npm run configure-sso

      3. Start the local web server and sideload the add-in:

         npm start

      4. Open the project in VS Code:

         code .

         For more information, visit http://code.visualstudio.com.

      Please visit https://docs.microsoft.com/office/dev/add-ins for more information about Office Add-ins.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

1) run generator as above 2) run npm run configure-sso

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Failure Logs

npm run configure-sso

> office-addin-taskpane-sso-js@0.0.0 configure-sso C:\SSO365
> office-addin-sso configure manifest.xml

(node:17100) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token  in JSON at position 3324
    at JSON.parse (<anonymous>)
    at C:\SSO365\node_modules\office-addin-sso\lib\configure.js:188:40
    at Generator.next (<anonymous>)
    at C:\SSO365\node_modules\office-addin-sso\lib\configure.js:6:71
    at new Promise (<anonymous>)
    at __awaiter (C:\SSO365\node_modules\office-addin-sso\lib\configure.js:2:12)
    at C:\SSO365\node_modules\office-addin-sso\lib\configure.js:182:95
    at ChildProcess.exithandler (child_process.js:299:7)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:17100) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:17100) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
TCourtneyOwen commented 3 years ago

@xstos Thanks for reporting this issue. Let me see if I can repro this issue and get back to you.

-Courtney

TCourtneyOwen commented 3 years ago

@xstos While I don't hit the precise error you are hitting, I do hit another error and it may be related. I suspect there has been a change in the Graph API that we use for configuring the SSO application that has broken our tooling:

(node:26940) UnhandledPromiseRejectionWarning: Error: Unable to determine if user is tenant admin: Bad Request({ "error": { "code": "Request_BadRequest", "message": "Invalid object identifier 'members'.", "innerError": { "date": "2021-02-01T21:03:04", "request-id": "898cee28-1d6d-484b-9263-075dc17598f9", "client-request-id": "898cee28-1d6d-484b-9263-075dc17598f9" } } })

I will see if I can determine the problem and get a fix out for it soon

-Courtney

xstos commented 3 years ago

Cool. I'm here to test if need be :)

TCourtneyOwen commented 3 years ago

It looks like the API for getting the directory members has changed: https://docs.microsoft.com/en-us/graph/api/directoryrole-list-members?view=graph-rest-1.0&tabs=http. It now requires an id, so our current az rest call to ""az rest -m get -u https://graph.microsoft.com/v1.0/directoryRoles/members --headers \"Content-Type=application/json\"" is invalid as we don't specify an id.

TCourtneyOwen commented 3 years ago

Aha! I figured out the real crux of the problem for the issue I am seeing and that others have reported. The directory roles names have changed and they no longer use the naming convention "Company Administrator" for a tenant admin - it's now called "Global Administrator." Hence, when we try to get the id associated with "Company Administrator", we get undefined which cause subsequent configuration of the tenant admin to fail

TCourtneyOwen commented 3 years ago

@xstos You can try apply this very simple change in node_module\offlce-addin-sso\lib\configure.js and see if things work for you: https://github.com/OfficeDev/Office-Addin-Scripts/pull/376

xstos commented 3 years ago

No dice

i stuck a console.log to see what was in the JSON at position 3324 (pasted below).

exports.logoutAzure = logoutAzure;
function promiseExecuteCommand(cmd, returnJson = true, expectError = false) {
    return __awaiter(this, void 0, void 0, function* () {
        return new Promise((resolve, reject) => {
            try {
                childProcess.exec(cmd, { maxBuffer: 1024 * 102400 }, (err, stdout, stderr) => __awaiter(this, void 0, void 0, function* () {
                    if (err && !expectError) {
                        reject(stderr);
                    }
                    let results = stdout;
                    if (results !== '' && returnJson) {
                        console.log(results); //<=== added
                        results = JSON.parse(results);
                    }
                    resolve(results);
                }));
            }
            catch (err) {
                reject(err);
            }
        });
    });
}

It appears to be complaining about this entry

{
        "DisplayName":  "NTFS Undelete 3.0.20.1104",
        "DisplayVersion":  null,
        "Publisher":  "Copyright c 2015 eSupport.com  All Rights Reserved",
        "InstallDate":  "20210111"
    },

The space between eSupport.com and All is suspect. It shows up as two spaces but an online unicode detector showed it as a regular space. Not sure.

xstos commented 3 years ago

In the meantime, instead of maintaining yeoman, y'all could just create a set of empty boilerplate addins on github that people can fork off of...

akrantz commented 3 years ago

The starting templates are in separate github repositories. You can clone them and start with them.

However, be sure to customize the manifest and use a unique id by running: npx office-addin-manifest modify --guid --displayName <name>

Here are a few of them: Basic: https://github.com/OfficeDev/Office-Addin-TaskPane React: https://github.com/OfficeDev/Office-Addin-TaskPane-React SSO: https://github.com/OfficeDev/Office-Addin-TaskPane-SSO

The yo-office branch is what is used when you run yo office. The master branch may have more recent changes which should work. We're constantly working to keep these templates updated.

xstos commented 3 years ago

I'd forgotten about those. My bad.

TCourtneyOwen commented 3 years ago

@xstos What is the the DisplayName specified in the manifest for your SSO project? I am wondering if this might be the source of the problem.

xstos commented 3 years ago

@TCourtneyOwen I don't have one? I just ran yeoman and then npm run configure-sso and it threw the error at the top of the thread.

xstos commented 3 years ago

Oh sorry I guess it's this <DisplayName DefaultValue="SSO365"/>

TCourtneyOwen commented 3 years ago

The project should have a manifest in it at the root of the project - Yo Office always creates a manifest with the project. If there is no manifest, this would most surely be the root of the problem, as configure-sso uses that DisplayName when creating the SSO application in Azure:

const applicationJson: Object = await configure.createNewApplication(manifestInfo.displayName, port.toString(), userJson);

xstos commented 3 years ago

Sorry I had put it at the beginning of the thread and I assumed I'd forgotten something. It's

<DisplayName DefaultValue="SSO365"/>

It's just the default manifest after running yeoman. No extra shenanigans...

TCourtneyOwen commented 3 years ago

Based on the output you pasted above it would seem the issue is happening in createNewApplication, as this is the first phase of the config process, and I don't see any other output logging indicating this phase succeeded. Here's the content of the method:

export async function createNewApplication(ssoAppName: string, port: string, userJson: Object): Promise { try { let azRestCommand = await fs.readFileSync(defaults.azRestAppCreateCommandPath, 'utf8'); const reName = new RegExp('{SSO-AppName}', 'g'); const rePort = new RegExp('{PORT}', 'g'); azRestCommand = azRestCommand.replace(reName, ssoAppName).replace(rePort, port); const applicationJson: Object = await promiseExecuteCommand(azRestCommand, true / returnJson /); return applicationJson; } catch (err) { const errorMessage: string = Unable to register new application: \n${err} throw new Error(errorMessage); } }

Could you please try the following:

  • open node_modules\office-addin-sso\lib\configure.js and add the following before the call to promiseExecuteCommand:

        console.log(`CreateNewApplication command is ${azRestCommand}`);
  • run "npm run configure-sso" again

  • capture the console output and forward in on in this thread

That way I can get a better sense if the command is somehow getting constructed improperly.

xstos commented 3 years ago

If you look in the thread above I already pinpointed the spot where it's breaking down. It didn't make it as far as createNewApplication To further illustrate I added console trace to promiseExecuteCommand

console.log("<LOG>")
console.trace(`${cmd}`);
console.log("</LOG>")
childProcess.exec(cmd, { maxBuffer: 1024 * 102400 }, (err, stdout, stderr) => __awaiter(this, void 0,
C:\repos\xstos\apps\playground\SSO365>npm run configure-sso

> office-addin-taskpane-sso-js@0.0.0 configure-sso C:\repos\xstos\apps\playground\SSO365
> office-addin-sso configure manifest.xml

<LOG>
Trace: powershell -ExecutionPolicy Bypass -File "C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\scripts\getInstalledApps.ps1"
    at console.originalConsole.<computed> [as trace] (C:\repos\xstos\apps\playground\SSO365\node_modules\diagnostic-channel-publishers\dist\src\console.pub.js:42:39)
    at C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\configure.js:184:13
    at new Promise (<anonymous>)
    at C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\configure.js:181:16
    at Generator.next (<anonymous>)
    at C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\configure.js:6:71
    at new Promise (<anonymous>)
    at __awaiter (C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\configure.js:2:12)
    at promiseExecuteCommand (C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\configure.js:180:12)
    at Object.<anonymous> (C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\configure.js:82:47)
</LOG>
(node:23532) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token  in JSON at position 3472
    at JSON.parse (<anonymous>)
    at C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\configure.js:192:40
    at Generator.next (<anonymous>)
    at C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\configure.js:6:71
    at new Promise (<anonymous>)
    at __awaiter (C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\configure.js:2:12)
    at C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\configure.js:186:95
    at ChildProcess.exithandler (child_process.js:299:7)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:23532) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:23532) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
xstos commented 3 years ago

I actually have the newly generated yeoman addin I'm using pushed to github already in case you wan't to try it yourself...

https://github.com/xstos/apps/tree/master/playground/SSO365

TCourtneyOwen commented 3 years ago

@xstos I just tried your project at https://github.com/xstos/apps/tree/master/playground/SSO365. After updating the office-addin-sso package to v,1.0.31, the configure-sso process worked fine for me.

I am curious what version of PowerShell you are running. I am running 5.1.19041.610. To get the version open PS and run the following:

  • $host = Get-Host
  • $host
  • You should see the version listed
xstos commented 3 years ago
Name             : ConsoleHost
Version          : 5.1.19041.610
InstanceId       : 2b3eea2c-519f-495d-bb91-2516454f0662
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

I also updated the version to 1.0.31 still no luck. So I added this line to configure.js and it fixed it.

results = JSON.parse(results.replace("Copyright c 2015 eSupport.com  All Rights Reserved","Copyright c 2015 eSupport.com All Rights Reserved"));

I opened the weird character after eSupport.com in a hex editor and it shows unicode  (U+0007) which seems broken to me.

Is it possible somebody accidentally corrupted the product list json by pasting a bad character?

xstos commented 3 years ago

So even though configure-sso worked after my json hack, when I npm start and browse to https://localhost:3000 I get the following. Shall I open another ticket for that?

Cannot find module 'html' Require stack: - C:\repos\xstos\apps\playground\SSO365\node_modules\express\lib\view.js - C:\repos\xstos\apps\playground\SSO365\node_modules\express\lib\application.js - C:\repos\xstos\apps\playground\SSO365\node_modules\express\lib\express.js - C:\repos\xstos\apps\playground\SSO365\node_modules\express\index.js - C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\app.js - C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\server.js - C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\commands.js - C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\cli.js - C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\cli.js
Error: Cannot find module 'html'
Require stack:
- C:\repos\xstos\apps\playground\SSO365\node_modules\express\lib\view.js
- C:\repos\xstos\apps\playground\SSO365\node_modules\express\lib\application.js
- C:\repos\xstos\apps\playground\SSO365\node_modules\express\lib\express.js
- C:\repos\xstos\apps\playground\SSO365\node_modules\express\index.js
- C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\app.js
- C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\server.js
- C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\commands.js
- C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\cli.js
- C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at Module.patchedRequire [as require] (C:\repos\xstos\apps\playground\SSO365\node_modules\diagnostic-channel\dist\src\patchRequire.js:14:46)
    at require (internal/modules/cjs/helpers.js:88:18)
    at new View (C:\repos\xstos\apps\playground\SSO365\node_modules\express\lib\view.js:81:14)
    at Function.render (C:\repos\xstos\apps\playground\SSO365\node_modules\express\lib\application.js:570:12)
    at ServerResponse.render (C:\repos\xstos\apps\playground\SSO365\node_modules\express\lib\response.js:1012:7)
    at C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\app.js:59:21
    at Layer.handle [as handle_request] (C:\repos\xstos\apps\playground\SSO365\node_modules\express\lib\router\layer.js:95:5)
xstos commented 3 years ago

I decided to run the exact same repo on my freshly installed Win10 work machine.

I didn't get that json error, but this happened instead.

C:\repos\xstos\apps\playground\SSO365>npm run configure-sso

> office-addin-taskpane-sso-js@0.0.0 configure-sso C:\repos\xstos\apps\playground\SSO365
> office-addin-sso configure manifest.xml

Opening browser for authentication to Azure. Enter valid Azure credentials
Login was successful!
Registering new application in Azure
Application was successfully registered with Azure
Setting identifierUri
Setting signin audience
(node:8840) UnhandledPromiseRejectionWarning: Error: Unable to determine if user is tenant admin:
ERROR: Bad Request({
  "error": {
    "code": "Request_BadRequest",
    "message": "Invalid object identifier 'members'.",
    "innerError": {
      "date": "2021-02-16T18:55:59",
      "request-id": "f6cb935e-edbd-4322-ae09-b11207df8dd1",
      "client-request-id": "f6cb935e-edbd-4322-ae09-b11207df8dd1"
    }
  }
})

    at Object.<anonymous> (C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\configure.js:155:19)
    at Generator.throw (<anonymous>)
    at rejected (C:\repos\xstos\apps\playground\SSO365\node_modules\office-addin-sso\lib\configure.js:4:65)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:8840) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8840) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

C:\repos\xstos\apps\playground\SSO365>
xstos commented 3 years ago

Because configure-sso already succeeded from my home machine, I decided to just try npm run start on my work machine to see if the missing express module happens. Something weird is happening with that webview prompt. It's not actually prompting due to the below error.

[1] ? Allow localhost loopback for Microsoft Edge WebView? (Y/n) (node:14564) UnhandledPromiseRejectionWarning: false
[0] (Use `node --trace-warnings ...` to show where the warning was created)
[0] (node:14564) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
[0] (node:14564) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[0] npm run start:server exited with code 0
TCourtneyOwen commented 3 years ago

Regarding this error:

ERROR: Bad Request({ "error": { "code": "Request_BadRequest", "message": "Invalid object identifier 'members'.", "innerError": { "date": "2021-02-16T18:55:59", "request-id": "f6cb935e-edbd-4322-ae09-b11207df8dd1", "client-request-id": "f6cb935e-edbd-4322-ae09-b11207df8dd1" } } })

Please update to the latest version of office-addin-sso (v.1.0.31) in your project. I am going to update the project template today to use that new version

xstos commented 3 years ago

Right cool forgot about the package.json. Any ideas on how to get past the Allow localhost loopback for Microsoft Edge WebView? thing? I don't mind hacking it in if need be...

TCourtneyOwen commented 3 years ago

Btw, I just published a new version of the SSO template, so if you create a new SSO project via Yo Office, it will have the "office-addin-sso" package update.

Can you please try the running the following at the root of your project to work around the loopback issue:

  • Run "npx office-addin-dev-settings appcontainer manifest.xml --loopback"
  • Say Yes when prompted with Allow localhost loopback for manifest.xml?
xstos commented 3 years ago

No dice. Ran it and saw

C:\repos\xstos\apps\playground\SSO365>npx office-addin-dev-settings appcontainer manifest.xml --loopback
? Allow localhost loopback for manifest.xml? Yes
Loopback is allowed.

But i'm still getting prompted on npm start. Weird.

xstos commented 3 years ago

all good I just commented out the prompt in \node_modules\office-addin-dev-settings\lib\appcontainer.js

function getUserConfirmation(name) {
    return __awaiter(this, void 0, void 0, function* () {
        const question = {
            message: `Allow localhost loopback for ${name}?`,
            name: "didUserConfirm",
            type: "confirm",
        };
        //const answers = yield inquirer.prompt([question]);
        return "Y";
    });
}

I'm glad we're getting closer as I was just tasked to enhance our outlook addin and this empty addin will make that way quicker to prove out. I can obviously set everything up myself like I did in the past, but your scripts/boilerplate save a ton of time. It's actually a shame the azure scripts weren't available when we first started, since one of our guys basically reimplemented the entire thing for deploying dev environments. Duplication of effort sucks, as I imagine every customer building O365 addins is doing the exact same work... I try to DRY but it never works out lol. I miss the excel native days where i could just record macros and customize them. Would be amazing if azure was built that way...

xstos commented 3 years ago

Crap the promise rejection is affecting debugging. I'll try to fix it by disabling strict unhandled rejections...

[0]
[0] > office-addin-taskpane-sso-js@0.0.0 start:server C:\repos\xstos\apps\playground\SSO365
[0] > office-addin-sso start manifest.xml
[0]
[1]
[1] > office-addin-taskpane-sso-js@0.0.0 sideload C:\repos\xstos\apps\playground\SSO365
[1] > office-addin-debugging start manifest.xml
[1]
[1] Debugging is being started...
[1] App type: desktop
[1] Enabled debugging for add-in d10ef321-c728-41de-bf14-c845eda0121f. Debug method: 0
[1] Sideloading the Office Add-in...
[1] Debugging started.
[0] (node:14956) UnhandledPromiseRejectionWarning: false
[0] (Use `node --trace-warnings ...` to show where the warning was created)
[0] (node:14956) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
[0] (node:14956) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[1] npm run sideload exited with code 0
[0] npm run start:server exited with code 0
xstos commented 3 years ago

So on the command line I did set NODE_OPTIONS="--unhandled-rejections=none" that got past the promise rejections. Then it seemed to start wanting to debug. Word opened and the task pane showed but showed a connection error. I'm also seeing the below message. I'm running node v14.15.5

[1] Debugging is being started...
[1] App type: desktop
[1] Enabled debugging for add-in d10ef321-c728-41de-bf14-c845eda0121f. Debug method: 0
[1] Sideloading the Office Add-in...
[1] Debugging started.
[0] npm run start:server exited with code 0
[1]
[1] ┌──────────────────────────────────────────────────────────────────────┐
[1] │                       npm update check failed                        │
[1] │                 Try running with sudo or get access                  │
[1] │                 to the local update config store via                 │
[1] │ sudo chown -R $USER:$(id -gn $USER) C:\Users\xstos\.config           │
[1] └──────────────────────────────────────────────────────────────────────┘
[1] npm run sideload exited with code 0
xstos commented 3 years ago

I tried https://stackoverflow.com/a/47861024/1618433 and that seemed to silence the npm error, but now the loading just silently gives up and the node processes just exit even though word shows "add-ins loaded successfully".

[1]
[1] > office-addin-taskpane-sso-js@0.0.0 sideload C:\repos\xstos\apps\playground\SSO365
[1] > office-addin-debugging start manifest.xml
[1]
[0]
[0] > office-addin-taskpane-sso-js@0.0.0 start:server C:\repos\xstos\apps\playground\SSO365
[0] > office-addin-sso start manifest.xml
[0]
[1] Debugging is being started...
[1] App type: desktop
[1] Enabled debugging for add-in d10ef321-c728-41de-bf14-c845eda0121f. Debug method: 0
[1] Sideloading the Office Add-in...
[1] Debugging started.
[1] npm run sideload exited with code 0
[0] npm run start:server exited with code 0
xstos commented 3 years ago

Heyooo it works. I reran configure-sso and somehow that fixed it. The output looks more normal now. I logged in to my O365 test tenant and it works in-browser as well. Phew.

[1]
[1] > office-addin-taskpane-sso-js@0.0.0 sideload C:\repos\xstos\apps\playground\SSO365
[1] > office-addin-debugging start manifest.xml
[1]
[0]
[0] > office-addin-taskpane-sso-js@0.0.0 start:server C:\repos\xstos\apps\playground\SSO365
[0] > office-addin-sso start manifest.xml
[0]
[1] Debugging is being started...
[1] App type: desktop
[1] Enabled debugging for add-in d10ef321-c728-41de-bf14-c845eda0121f. Debug method: 0
[1] Sideloading the Office Add-in...
[1] Debugging started.
[0] You already have trusted access to https://localhost.
[0] Certificate: C:\Users\xstos\.office-addin-dev-certs\localhost.crt
[0] Key: C:\Users\xstos\.office-addin-dev-certs\localhost.key
[0] Server running on 3000
[0] GET /assets/icon-32.png 404 265.380 ms - 1105
[0] GET /assets/icon-64.png 404 269.495 ms - 1105
[0] GET /assets/icon-16.png 404 272.748 ms - 1105
[0] GET /assets/icon-32.png 404 275.862 ms - 1105
[0] GET /assets/icon-32.png 404 5.101 ms - 1105
[0] GET /assets/icon-80.png 404 8.671 ms - 1105 ......
millerds commented 3 years ago

The default template for SSO should be working at this point. If there are still issues please reopen.