"No Predicate Match" error when using config file created from proxy

141 views
Skip to first unread message

Trevor Philbrick

unread,
Feb 16, 2023, 4:46:23 PM2/16/23
to mountebank-discuss
Hello,

I am new to Mountebank, and have been running into an error when trying to run the mountebank server with a config file I have saved from a previous proxy session. I am able to run "mb restart --configFile <myFile>" and the service starts. I can make a request through postman but I receive the following in the console: " [https:9900 proxyOnce] no predicate match, using default response". Any help would be much appreciated.

Prathibha Panneer Selvam

unread,
Mar 26, 2024, 3:55:49 PM3/26/24
to mountebank-discuss
Hi, 
I'm facing the same issue, please assist on this.

I used ProxyOnce to record my request and response in a stub and I tried to check using curl command.
For example, this is my host url --- curl -X GET http://127.0.0.1:9907/get -i
below is the response,
HTTP/1.1 200 OK
Connection: close
Date: Tue, 26 Mar 2024 19:47:07 GMT
Transfer-Encoding: chunked

It just gives the status code, but not the response. And in my log it says as below.
info: [http:9907] ::ffff:127.0.0.1:2921 => GET /get
info: [http:9907] no predicate match, using default response

fyr, pasting my stub.json file
{
    "imposters": [
        {
        "protocol": "http",
        "port": 9907,

       "predicates": [
         {
           
           "equals": {
             "headers": {
               "Host": "127.0.0.1:9907",
               "Connection": "keep-alive",
               "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
               "Accept": "*/*",
               "Sec-Fetch-Site": "none",
               "Sec-Fetch-Mode": "cors",
               "Sec-Fetch-Dest": "empty",
               "Accept-Encoding": "gzip, deflate, br",
               "Accept-Language": "en-US,en;q=0.9,bn;q=0.8,hi;q=0.7"
             }
           }
         },
         {
         
           "deepEquals": {
             "method": "GET"
           }
         },
         {
         
           "deepEquals": {
             "path": "/get"
           }
         }
       ],
       "responses": [
         {
           "is": {
             "statusCode": 200,
             "headers": {
                "Date": "Tue, 26 Mar 2024 19:09:14 GMT",
               "Content-Type": "application/json",
               "Content-Length": "552",
               "Connection": "keep-alive",
               "Server": "gunicorn/19.9.0",
               "Access-Control-Allow-Origin": "*",
               "Access-Control-Allow-Credentials": "true"
             },
             "body": "{\n  \"args\": {}, \n  \"headers\": {\n    \"Accept\": \"*/*\", \n    \"Accept-Encoding\": \"gzip, deflate, br\", \n    \"Accept-Language\": \"en-US,en;q=0.9,bn;q=0.8,hi;q=0.7\", \n    \"Host\": \"httpbin.org\", \n    \"Sec-Fetch-Dest\": \"empty\", \n    \"Sec-Fetch-Mode\": \"cors\", \n    \"Sec-Fetch-Site\": \"none\", \n    \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36\", \n    \"X-Amzn-Trace-Id\": \"Root=1-5f41681e-1d64b97fd4a6a3a28353395b\"\n  }, \n  \"origin\": \"106.215.49.96\", \n  \"url\": \"http://httpbin.org/get\"\n}\n",
             "_mode": "text"
           }
         }
       ]
     }
    ]
}





Please help to resolve by identifying the issue, I also tried with 'equals' instead of 'deepEquals' still the issue persists.


Thanks,
Prathibha

Prathibha Panneer Selvam

unread,
Mar 26, 2024, 4:39:50 PM3/26/24
to mountebank-discuss
My issue is resolved, after removing the details in headers section except Host. 
"equals": {
                "headers": {
                  "Host": "127.0.0.1:9909"
                 
                }
              }
Reply all
Reply to author
Forward
0 new messages