Reputation: 33625
I have a published working API on the API manager and I made some changes in the API code in the integration studio then exported a CAR file.
After that I have deployed the car file of my API in the micro integrator 7.1.0 and restarted the micro integrator then make save and deploy in the API manager to publish a new version of the API (usually this works with no issues, and I have done this several times)
The API Endpoint configuration is load balanced on two service urls as follows:
http://10.10.10.1:8290/demo-api/
http://10.10.10.2:8290/demo-api/
when invoking curl in the backend server (micro integrator) it works just fine and return result:
curl -X GET http://10.10.10.1:8290/demo-api/getCountriesLookup
but when calling the API through the API manager as follows:
curl -X GET https://am.mydomain:443/demo/1.0.0/getCountriesLookup
I get the following response :
{
"code": "404",
"type": "Status report",
"message": "Not Found",
"description": "The requested resource is not available."
}
When viewing the API manager logs I see the following exception :
TID: [-1] [] [2022-12-14 10:53:40,921] INFO {org.apache.synapse.transport.passthru.SourceHandler} - Writer null when calling informWriterError
TID: [-1234] [] [2022-12-14 10:53:41,129] INFO {org.apache.synapse.mediators.builtin.LogMediator} - STATUS = Message dispatched to the main sequence. Invalid URL., RESOURCE = /demo/1.0.0/getCountriesLookup, HEALTH CHECK URL = /demo/1.0.0/getCountriesLookup
TID: [-1] [] [2022-12-14 10:53:42,270] ERROR {org.apache.synapse.transport.passthru.SourceHandler} - HttpException occurred org.apache.http.ProtocolException: Invalid request line: GET /
at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:209)
at org.apache.synapse.transport.http.conn.LoggingNHttpServerConnection$LoggingNHttpMessageParser.parse(LoggingNHttpServerConnection.java:410)
at org.apache.synapse.transport.http.conn.LoggingNHttpServerConnection$LoggingNHttpMessageParser.parse(LoggingNHttpServerConnection.java:384)
at org.apache.http.impl.nio.DefaultNHttpServerConnection.consumeInput(DefaultNHttpServerConnection.java:262)
at org.apache.synapse.transport.http.conn.LoggingNHttpServerConnection.consumeInput(LoggingNHttpServerConnection.java:114)
at org.apache.synapse.transport.passthru.ServerIODispatch.onInputReady(ServerIODispatch.java:82)
at org.apache.synapse.transport.passthru.ServerIODispatch.onInputReady(ServerIODispatch.java:39)
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.apache.http.ParseException: Invalid request line: GET /
at org.apache.http.message.BasicLineParser.parseRequestLine(BasicLineParser.java:302)
at org.apache.http.impl.nio.codecs.DefaultHttpRequestParser.createMessage(DefaultHttpRequestParser.java:117)
at org.apache.http.impl.nio.codecs.DefaultHttpRequestParser.createMessage(DefaultHttpRequestParser.java:50)
at org.apache.http.impl.nio.codecs.AbstractMessageParser.parseHeadLine(AbstractMessageParser.java:156)
at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:207)
... 14 more
NOTE : the API Manager logs mentioned RESOURCE = /demo/1.0.0/getCountriesLookup
instead of RESOURCE = /demo-api/1.0.0/getCountriesLookup
I don't know why ? where did this context comes from ?
UPDATE : added API endpoint configuration screenshot
Update 2 : The URL I get in the try out console in the API Manager
curl -X 'GET' \'https://am.mydomain:443/demo/1.0.0/getCountriesLookup' \
-H 'accept: */*' \
Upvotes: 0
Views: 1763
Reputation: 1
i had the same problem and yes, I dont know what was the problem exactly but with deleting the API from the API manager and creating it again the problem solved.
Upvotes: 0
Reputation: 33625
I resolved the issue by deleting the API from the API manager and creating it again.
Upvotes: 0
Reputation: 1031
With APIM 4.0.0, in order for a change to be applied in the gateway, you need to create a new revision and deploy that revision in the gateway. The lifecycle state and the deployment states are now decoupled compared to precision versions.
Can you verify whether your latest changes are revisioned and deployed properly in the gateway?
Upvotes: 1