Home > Net >  NestJS returns 404 page for provider pact verification test
NestJS returns 404 page for provider pact verification test

Time:12-08

I have a NestJS v8.4.0 application. When I run provider verification test my application returns 404 “Cannot PUT url…”. If I copy-paste the URL into Postman and run the request myself it works as expected.

The questions are:

  1. Why does it return 404 error for pact initiated request but doesn’t do so for the hand-made request with the same URL, headers, body?
  2. How can I debug for NestJS/Express routes matching to see why it cannot match the route?

To do the hand-made request I remove server.close() so that I can make a request against the same environment. Environment is the same both for pact made requests and hand-mage. Compared to Jest tests pact tests doen’t have any teardown. Hence, all mocks I’ve made for pact tests are used for hand-made request as well.

CodePudding user response:

Somehow the problem is in running pact verification tests with ts-node only and in this project only. If used pure JS for pacts verification - it works. Can’t explain it, but using JS fixed the issue

  • Related