<#1016 404 Cannot PUT> Issue created by <gultyayev...
# pact-js-development
g
#1016 404 Cannot PUT Issue created by gultyayev Software versionsOS: Mac OSX 13.0.1 • Provider Pact library: "@pact-foundation/pact": "^10.3.1" • Node Version: v14.18.1 Issue Checklist Please confirm the following: ☑︎ I have upgraded to the latest ☑︎ I have the read the FAQs in the Readme ☑︎ I have triple checked, that there are no unhandled promises in my code and have read the section on intermittent test failures ☑︎ I have set my log level to debug and attached a log file showing the complete request/response cycle ☐ For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem Expected behaviour Should make a request to my NestJS service. Actual behaviour Pact's proxy server doesn't make a request. It returns 404 HTML error page Cannot PUT ... My application doesn't print the request in the logs which means that it never received the request. (I also made the request manually to my local server and it was working which was also a proof that the server never received the request). As a test I omitted local server bootstrap and the error persisted, which proved that my application isn't even in the equation. The error is thrown by pact's proxy Express server. Steps to reproduce I'm not sure if it's reproducible. We had a pact generated by Java consumer headers:
Copy code
"Authorization": "Bearer auth_token",
"Content-Type": "application/json"
body:
Copy code
{
  "serviceAttributes": [
    "string1",
    "string2"
  ]
}
Relevant log files
Copy code
2022-12-07T09:05:11.021458Z  INFO ThreadId(02) verify_interaction{interaction="A request to update service attributes for Patient"}: pact_verifier: Running provider verification for 'A request to update service attributes for Patient'
2022-12-07T09:05:11.021508Z DEBUG ThreadId(02) verify_interaction{interaction="A request to update service attributes for Patient"}: pact_verifier: Verifying a HTTP interaction
2022-12-07T09:05:11.021537Z  INFO ThreadId(02) verify_interaction{interaction="A request to update service attributes for Patient"}: pact_verifier::provider_client: Sending request to provider at <http://127.0.0.1:64155/>
...
{"level":20,"time":1670403911036,"pid":45449,"hostname":"masked","msg":"pact@10.3.1: incoming request: {\"body\":{\"serviceAttributes\":[\"string1\",\"string2\"]},\"headers\":{\"authorization\":\"Bearer auth_token\",\"content-type\":\"application/json\",\"accept\":\"*/*\",\"accept-encoding\":\"gzip, deflate\",\"host\":\"127.0.0.1:64155\",\"content-length\":\"38\"},\"method\":\"PUT\",\"path\":\"/api/v1/tenant/tenantId/user/userId/service-attribution\"}"}
{"level":20,"time":1670403911037,"pid":45449,"hostname":"masked","msg":"pact@10.3.1: outgoing response: {\"body\":\"<!DOCTYPE html>\\n<html lang=\\\"en\\\">\\n<head>\\n<meta charset=\\\"utf-8\\\">\\n<title>Error</title>\\n</head>\\n<body>\\n<pre>Cannot PUT /api/v1/tenant/tenantId/user/userId/service-attribution</pre>\\n</body>\\n</html>\\n\",\"headers\":{\"x-powered-by\":\"Express\",\"content-security-policy\":\"default-src 'none'\",\"x-content-type-options\":\"nosniff\",\"content-type\":\"text/html; charset=utf-8\",\"content-length\":220},\"status\":404}"}
P.S. In the logs it says that it sends a request to a provider at "http://127.0.0.1:64155/", but my providerBaseUrl is "http://localhost:3000", just in case. pact-foundation/pact-js