OfficeDev / Office-Add-in-samples

Code samples for Office Add-in development on the Microsoft 365 platform.
MIT License
754 stars 808 forks source link

Unable to deploy 'Office-Add-in-NodeJS-SSO' in production server #875

Closed mokarom closed 3 weeks ago

mokarom commented 1 month ago

Note: This repo is only for questions related to its samples. If you have questions about how to use office.js or the Office developer platform, please post your question on https://stackoverflow.com. Tag your question with office-js or outlook-web-addins

Question How to deploy 'Office-Add-in-NodeJS-SSO' in production?

Ask your question here. I'm able to test this sample in development mode. When tried to deploy in production I am not sure how this can be done. I'm trying to deploy in my Local IIS (IIS (Windows 10, IIS 10) but unable to make it work. The error says 404.0 not found DeployExcelAddin

I followed several articles to deploy node.js application -

  1. Tried to copy the whole 'Complete' folder and deployed as a web site in IIS (Windows 10, IIS 10).
  2. https://medium.com/@adarsh-d/deploy-node-js-application-on-iis-9703d5dfcaca

Please provide a guidance on how the sample can be deployed in Local IIS.

AlexJerabek commented 1 month ago

Hi @mokarom,

Thank you for reporting this issue. @davidchesnut, could you please take a look?

davidchesnut commented 1 month ago

Hi @mokarom,

Have you tried the article: Deploy a single sign-on (SSO) Office Add-in to Microsoft Azure App Service? You don't have to use Azure as in the article, but I would take a look at the following items.

Hope this helps, David

mokarom commented 1 month ago

Have you tried the article: Deploy a single sign-on (SSO) Office Add-in to Microsoft Azure App Service? You don't have to use Azure as in the article, but I would take a look at the following items.

Yes I tried this article and deployed in Azure app service and also in local IIS following the steps provided in the article.

Yeoman Generator Sample Error

Please note that the the error screencast is taken from local deployment.

According to this SO post 'yeoman office generator' cannot be used as the starter project for a production add-in that uses SSO' and suggested to try Office Add-ins Samples - auth.

As specified before, 'Office Add-ins Samples - auth' sample runs fine in development mode. But I'm unable to deploy it in local IIS.

mokarom commented 1 month ago

After trying this article Deploy a single sign-on (SSO) Office Add-in to Microsoft Azure App Service again it worked.

It is unclear why it worked this time. One thing I noticed that though I updated the .env file with 'NODE_ENV=production', but as I checked the file in Azure deployment the variable remained as NODE_ENV=development which doesn't make any sense. After manually updating the environment variable It worked without the error it was showing previously.

Thanks for your help.

davidchesnut commented 3 weeks ago

Hi @mokarom, glad to hear this is working for you now! I'll go ahead and close this issue. Let us know if you need anything else! Thanks!