500 Response with JSON Parser

Hello there,

I am currently trying to get a minimal webserver running with Cowboy and Plug. The purpose of it is to handle webhooks (JSON payloads on a POST endpoint) but I am struggling to get the JSON parsed. I’ve added the Parser plug with json to my module but as soon as I send a request to that endpoint (or any other endpoint) with a JSON payload, I receive an 500 error with no additionall logging.

Here’s my modules code: https://gist.github.com/Rukenshia/9688dca4d3af63188ae45185f1a65f4d


turns out I forgot to add poison to my dependencies.

1 Like

You do only allow text/* MIME-type while you send application/json. Try changing your :pass config or temporarily use another mediatype with curl.

I’m still surprised about the lack of useful error output. Does bare Plug do some error suppression here that Phoenix doesn’t or something?

Phoenix adds that whole fancy error reporting page by default in your error handler (only in dev), it is configured on/off by the option in your dev.exs file. :slight_smile: