https://docs.microsoft.com/en-us/answers/questions/530642/office-js-addin-with-webapi-failed-to-fetch.html

RaoulRSV 31 Reputation points
2021-09-15T09:17:18.36+00:00

My application contains one office-js addin (typescript) project + one Webapi core (c#) project, both communicating through a fetch function when cors is enabled.It works together properly on my local computer.

I published :

However when used, fetch function raises errors (message = "failed to fetch").The issue may be about proper ssl certificates as described in : https://learn.microsoft.com/en-us/office/dev/add-ins/concepts/requirements-for-running-office-add-ins.

Is it a possible solution ?

I tried with self signed certificate with no success so far. Is there any tutorial explaining how to implement it ?

Any help would be appreciated

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,157 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,479 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 55,601 Reputation points
    2021-09-15T21:11:47.43+00:00

    The certificate is for loading the add in, not the fetch. You fetch code should display some debug info. What was the response code, status text, any payload, response content-type etc.


  2. Bruce (SqlWork.com) 55,601 Reputation points
    2021-09-16T15:04:49.143+00:00

    As the error is 404 (not found), either the url, method or payload is invalid. You should be able to see all this in fiddler.


  3. RaoulRSV 31 Reputation points
    2021-09-29T16:44:39.067+00:00

    Closed. Finally it was about :

    • debugging in localhost is not enough. You have to test with Swagger. In my case I had a wrong return with a String[] and the decoration of the controller was not ok
    • having a plain Web api application (ie : with a wwwroot)
    0 comments No comments