product-apim: Error 404 on any API published in 4.0.0-rc
Description:
Any API deployed and published on 4.0.0-rc will return 404 when invoked through API gateway. Gateway returns error: {"code":"404","type":"Status report","message":"Not Found","description":"The requested resource is not available."}
Log shows:
INFO - LogMediator STATUS = Message dispatched to the main sequence. Invalid URL., RESOURCE = /testapi/1.0/test, HEALTH CHECK URL = /testapi/1.0/test
Steps to reproduce:
Download and extract API Manager 4.0.0-rc. Configure for MySQL database, add MySQL JDBC driver. Configure hostname, proxy ports for nginx as proxy server, and endpoint URLs in [[apim.gateway.environment]]. Start api-manager.sh.
Create new API of any kind, either new API or import OAPI definition file.
There will be no errors in logs or in API Publisher, API will be published without errors, but invoking, either via Publisher, Devportal or curl will produce 404 error as if API does not exist.
Affected Product Version:
4.0.0-rc
Environment details (with versions):
- OS: Linux Debian 10
- Env (Docker/K8s): Virtual machine
Suggested Labels:
4.0.0, Type/Bug
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15
Help ! I’m facing same issue on 4.1.0. each time I publish a new API and then call it, I get 404 and when I restart the server it works then (so any time I need to add an API, I first add it and restart the server to get it ok). in the UI we get the error :
<html> <body>Failed to fetch.Possible Reasons:CORSNetwork FailureURL scheme must be “http” or “https” for CORS request.
</body> </html> and on the server side we can see :{“code”:“404”,“type”:“Status report”,“message”:“Not Found”,“description”:“The requested resource is not available.”}
I’m closing this issue since I’ve found the solution for my case.
I think I know why this happens. On a local machine, there’s only 1 default API gateway which is localhost, so the resources are fine with that. But on a remote one, in my case it’s an EC2 Instance, it has 2 API gateways, one is its localhost, another is the DNS point to the IP of the machine. After changes, I only deploy it to the DNS API gateway and not the localhost. I just tried to deploy a new revision to all API Gateway it has, and now it works if we call it from Postman. However, it doesn’t work on the UI and prompts me with TypeError : Load Failed.