Skip to content

Troubleshooting

Beth Skurrie edited this page Apr 28, 2019 · 1 revision

How to check the logs

If you are using a Pact Broker client (eg. maven plugin, pact-broker CLI) work out how you can run it in debug mode to make sure you're seeing all the possible errors.

Start the docker container in debug mode by setting the environment variable PACT_BROKER_LOG_LEVEL to DEBUG. Get name of broker container by running docker ps Run docker logs -f CONTAINER_NAME Do the thing that causes the problem (eg. verification)

If you can't see anything helpful in that log, have a look at the nginx access log.

Run docker exec -it CONTAINER_NAME bash Run cat /var/log/nginx/access.log You'll see something like this:

172.17.0.1 - foo [10/Oct/2017:04:22:20 +0000] "POST /pacts/provider/Bar/consumer/Foo/pact-version/8d888dc6024e7ff236af4a72fe5efddd7d16904a/verification-results HTTP/1.1 201"

That first number after HTTP/1.1 is the response code. If it is 400, you have a validation error. If it is 401, you have incorrect credentials.

For 1337 H4x0rs

If you want to do some serious hacking or debugging, you can modify the ruby source code. puts is your friend here. The main configuration code can be found in /home/app/pact_broker/config.ru and the ruby files in the same folder. The pact_broker gem code can be found in /home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/pact_broker-{GEM_VERSION}/lib. Once you've saved your changes, restart the passenger server using passenger-config restart-app --name /home/app/pact_broker/public, then run docker logs -f ${CONTAINER_NAME} while performing whatever task recreates your issue.

Note that these changes will be lost the next time you restart the docker container.

Clone this wiki locally