2
votes

I am using wso2 api manager 2.6.0. I have created a prototyped api. When I try to invoke the api from store api console ,I get an error
TypeError: Failed to fetch

When I take the curl command from the api console and execute it from command prompt on the same server where wso2 api manager is installed I get the expected response.

As it a GET method , If I take the url and execute it on a chrome browser , it takes me the management console page. When I sign in to the management console page , the browser displays Error 405 - Method Not Allowed

When I trigger the endpoint from postman, it returns an html page which is the same management console page.

I have checked that the host and port for the gatewayendpoint and OAuthConfigurations/revokeapiurl are same and the host is whitelisted in the store site.json.

Any idea what is wrong or how can I debug it.

API ConsoleCommand Line Invocation From Same HostBrowserErrorAfterSigninginthecarbonconsolePostman Invocation

1
Your API Manager is in local or in a remote server ?Robyn.D
it is in aws ec2 instanceGaurav

1 Answers

0
votes

Usually TypeError: Failed to fetch comes because of the self-signed certificate which comes by default with the server. If that is the case, accepting the security certificate from the browser should fix the problem.

From docs[2]:

Troubleshooting

If you cannot invoke the API's HTTPS endpoint (this causes the SSLPeerUnverified exception), it could be because the security certificate issued by the server is not trusted by your browser. To resolve this issue, access the HTTPS endpoint directly from your browser and accept the security certificate.

If the API Manager has a certificate signed by a Certificate Authority (CA), the HTTPS endpoints should work out of the box.

[2] https://docs.wso2.com/display/AM260/Invoke+an+API+using+the+Integrated+API+Console