portal light, 'try it out' TypeError: Failed to fetch

samuelucich
Participant IV

HI,

After creating an Api Product (proxy-mock-target-product), and adding it to my Portal, i can see it on the portal.

6401-portalapis.png

If I click on this, I get to the swagger test page. But when I try to execute any of the methods, I see a 200 success, but also a 'TypeError: Failed to fetch'.

The Curl cmd shown in the UI is valid and returns the expected response if i run it on a server. The url in the curl cmd, loaded into a browser, also returns the expected response.

So why doesn't this test page return the expected response?

6403-testpage2.jpg

0 4 3,345
4 REPLIES 4

faijahmad
Participant V

Can you check and share with us the error you're getting in your browser's console? It may be your application needs to send back a Access-Control-Allow-Origin: * header in order to communicate.

I see this in the console. Is https a requirment when using the portal light swagger test page for a given Api?

VM41:39 Mixed Content: The page at 'https://samuelucich-trial-myportal.apigee.io/#/default/View_a_personalized_greeting' was loaded over HTTPS, but requested an insecure resource 'http://samuelucich-trial-test.apigee.net/proxy-mock-target-api/'. This request has been blocked; the content must be served over HTTPS.

Browsers will restrict mixed content. If a page is served via HTTPS, and an unsecured
XHR call is made from the page, it will be blocked.

https://developers.google.com/web/fundamentals/security/prevent-mixed-content/fixing-mixed-content?h...

In this case since the portal is served via HTTPS, all calls made from API spec must use HTTPS as well. So you are correct, it is a requirement that your API serve its endpoints via HTTPS, and they should be documented as such in the spec.

Hi @samuel ucich,

See the Troubleshooting issues with your published APIs for guidance on addressing this error. Let us know if this helps!

Apologies for the inconvenience!

Liz