question

RaoulRSV-4218 avatar image
0 Votes"
RaoulRSV-4218 asked RaoulRSV-4218 commented

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

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 :
- the webapi on azure api management (https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-rest-api). Test gaves a 200 OK.
- the Office addin on azure. It works properly (as long the fetch function is not involved).

However when used, fetch function raises errors (message = "failed to fetch").The issue may be about proper ssl certificates as described in : https://docs.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

office-addins-devdotnet-aspnet-core-webapi
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered RaoulRSV-4218 commented

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.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

A request from localhost(office addin) to azure (web api in azure: https://xxx.azure-api.net) gives on fiddler :
132656-localhost-to-azure-160921.png


0 Votes 0 ·
Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered RaoulRSV-4218 commented

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.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

IThe URL I am using is https://xxx.azure-api.net, the method is "post" and the payload (function name + body) is the same as for localhost.
When I use these parameters for a test in Azure api management it works properly.

What could be wrong ?

0 Votes 0 ·