When testing the response caching mechanism through the integrated try out console in the developer portal using Google Chrome browser or using curl command through the terminal, it is working as expected.
But, when testing out the response caching mechanism through the integrated try out console in the developer portal using the Firefox browser(98.0.1 (64-bit)), the response caching is not working properly. (The API invocation reaches the backend) and the following error gets logged in the server console.
ERROR - SequenceMediator {api:api3:v1.0.0} Runtime error occurred while mediating the message
java.lang.NullPointerException: null
at org.apache.synapse.util.MessageHelper.cloneSOAPEnvelope(MessageHelper.java:563) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.wso2.carbon.mediator.cache.CacheMediator.replaceEnvelopeWithCachedResponse(CacheMediator.java:353) ~[org.wso2.carbon.mediator.cache_4.7.130.jar:?]
at org.wso2.carbon.mediator.cache.CacheMediator.processResponseMessage(CacheMediator.java:455) ~[org.wso2.carbon.mediator.cache_4.7.130.jar:?]
at org.wso2.carbon.mediator.cache.CacheMediator.mediate(CacheMediator.java:251) ~[org.wso2.carbon.mediator.cache_4.7.130.jar:?]
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:110) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.api.Resource.process(Resource.java:342) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.api.API.process(API.java:416) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.api.AbstractApiHandler.apiProcessNonDefaultStrategy(AbstractApiHandler.java:107) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.api.AbstractApiHandler.identifyAPI(AbstractApiHandler.java:127) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.api.AbstractApiHandler.dispatchToAPI(AbstractApiHandler.java:54) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.api.rest.RestRequestHandler.dispatchToAPI(RestRequestHandler.java:90) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.api.rest.RestRequestHandler.process(RestRequestHandler.java:63) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:54) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:344) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:627) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:208) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) ~[axis2_1.6.1.wso2v80.jar:?]
at org.wso2.carbon.core.multitenancy.MultitenantMessageReceiver.processResponse(MultitenantMessageReceiver.java:192) ~[org.wso2.carbon.core_4.6.3.jar:?]
at org.wso2.carbon.core.multitenancy.MultitenantMessageReceiver.receive(MultitenantMessageReceiver.java:92) ~[org.wso2.carbon.core_4.6.3.jar:?]
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) ~[axis2_1.6.1.wso2v80.jar:?]
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:298) ~[synapse-nhttp-transport_2.1.7.wso2v270.jar:?]
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) ~[axis2_1.6.1.wso2v80.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_241]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_241]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_241]
[2022-03-22 19:13:06,415] ERROR - api3 Runtime error occurred while mediating the message
java.lang.NullPointerException: null
at org.apache.synapse.util.MessageHelper.cloneSOAPEnvelope(MessageHelper.java:563) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.wso2.carbon.mediator.cache.CacheMediator.replaceEnvelopeWithCachedResponse(CacheMediator.java:353) ~[org.wso2.carbon.mediator.cache_4.7.130.jar:?]
at org.wso2.carbon.mediator.cache.CacheMediator.processResponseMessage(CacheMediator.java:455) ~[org.wso2.carbon.mediator.cache_4.7.130.jar:?]
at org.wso2.carbon.mediator.cache.CacheMediator.mediate(CacheMediator.java:251) ~[org.wso2.carbon.mediator.cache_4.7.130.jar:?]
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:110) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.api.Resource.process(Resource.java:342) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.api.API.process(API.java:416) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.api.AbstractApiHandler.apiProcessNonDefaultStrategy(AbstractApiHandler.java:107) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.api.AbstractApiHandler.identifyAPI(AbstractApiHandler.java:127) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.api.AbstractApiHandler.dispatchToAPI(AbstractApiHandler.java:54) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.api.rest.RestRequestHandler.dispatchToAPI(RestRequestHandler.java:90) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.api.rest.RestRequestHandler.process(RestRequestHandler.java:63) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:54) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:344) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:627) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:208) ~[synapse-core_2.1.7.wso2v270.jar:2.1.7-wso2v270]
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) ~[axis2_1.6.1.wso2v80.jar:?]
at org.wso2.carbon.core.multitenancy.MultitenantMessageReceiver.processResponse(MultitenantMessageReceiver.java:192) ~[org.wso2.carbon.core_4.6.3.jar:?]
at org.wso2.carbon.core.multitenancy.MultitenantMessageReceiver.receive(MultitenantMessageReceiver.java:92) ~[org.wso2.carbon.core_4.6.3.jar:?]
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) ~[axis2_1.6.1.wso2v80.jar:?]
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:298) ~[synapse-nhttp-transport_2.1.7.wso2v270.jar:?]
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) ~[axis2_1.6.1.wso2v80.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_241]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_241]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_241]
[2022-03-22 19:13:06,415] INFO - LogMediator {api:api3:v1.0.0} STATUS = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Runtime error occurred while mediating the message
Steps to reproduce:
Followed the response caching documentation [1]
Log in to the Publisher Portal
Created an API and enabled Response Caching by providing cache timeout value as 100 seconds.
Deployed and Published the API
Log in to the Developer Portal
Created a new application and generated keys
Subscribed the created API to this application and generated an access token
Moved to the try out tab and pasted the generated access token in the Access Token field.
Expanded a resources and executed it several times with a small gap in between each execution
The above mentioned error gets printed in the server console. It can be noticed that the backend also has been called. (I had added a print statement when the backend is called)
Description:
When testing the response caching mechanism through the integrated try out console in the developer portal using Google Chrome browser or using curl command through the terminal, it is working as expected.
But, when testing out the response caching mechanism through the integrated try out console in the developer portal using the Firefox browser(98.0.1 (64-bit)), the response caching is not working properly. (The API invocation reaches the backend) and the following error gets logged in the server console.
Steps to reproduce:
Followed the response caching documentation [1]
The above mentioned error gets printed in the server console. It can be noticed that the backend also has been called. (I had added a print statement when the backend is called)
[1] https://apim.docs.wso2.com/en/4.1.0/deploy-and-publish/deploy-on-gateway/api-gateway/response-caching/#enabling-response-caching-for-an-api
Environment details (with versions):