Fork me on GitHub
#ring-swagger
<
2016-10-13
>
challen15:10:34

Hi all, I was running into a bizarre issue with Compojure-api yesterday and was hoping I could get some help getting to the bottom of it.

challen15:10:05

We just updated from version 0.21.0 to 1.8.0 and everything was working except for one PUT method. It returns either a 200 or a 201 code. When it should be returning a 201, it instead returns a 500 code with the error-body :error (not (map? nil))

challen15:10:24

I changed the code to instead return a 200 in all scenarios, and it worked.

challen15:10:55

There was nothing in the server logs that indicated an error; no exceptions or ERRORS logging

challen15:10:33

Lastly, this does not happen if I use compojure-api v. 1.3.0, but occurs in every version since.

juhoteperi15:10:12

There is no such compojure-api version

challen15:10:43

oh, sorry 1.1.3 and 1.1.8

juhoteperi15:10:49

That error body says that the response body doesn't validate against response schema

juhoteperi15:10:05

Have you declared response schemas for both 200 and 201 responses?

challen15:10:58

yep, we use the same Schema for both

juhoteperi15:10:55

hmm, the error says that the body is nil

ikitommi15:10:22

about logging, request & response validation errors are not logged, here's how to enable those: https://github.com/metosin/compojure-api/wiki/Exception-handling#logging

ikitommi15:10:14

But propably your code is returning nil and the response coercion fails.