h2non / imaginary

Fast, simple, scalable, Docker-ready HTTP microservice for high-level image processing
https://fly.io/docs/app-guides/run-a-global-image-service/
MIT License
5.5k stars 455 forks source link

How to debug error 400 ? #403

Closed Pix13 closed 1 year ago

Pix13 commented 1 year ago

Hi,

I plugged Nexcloud 24 to an imaginary instance, but i only have errors 400 when it uses it, and the there is not much logs with DEBUG=*

2022/09/22 10:47:48 FreeOSMemory()
xx.xx.xx.xx - - [22/Sep/2022 08:48:05] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22smartcrop%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 400 41 29.9951
xx.xx.xx.xx - - [22/Sep/2022 08:48:05] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22smartcrop%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 400 41 29.9974

Is there a way to have an even more verbose output to understand what's wrong with the paylod of the POST ?

Pix13 commented 1 year ago

( issue was that nextcloud was sending garbage)

lenaxia commented 1 year ago

Do you mind sharing how you identified that NC was sending garbage? I'm seeing 403's in my logs but am not sure where to start looking.

Pix13 commented 1 year ago

Do you mind sharing how you identified that NC was sending garbage? I'm seeing 403's in my logs but am not sure where to start looking.

I compared the logs of the test suite of imaginary with those of the nextcloud requests, used the inspector on chrome to see the payloads, and finally figured out that imaginary received data that it could not probe as pictures, because i had server-side encryption on nextcloud.. and that nextcloud, in its infinite wisdom, was sending the encrypted pictures to imaginary. Had to un-encrypt my whole dataset