Closed SimonLab closed 7 years ago
@SimonLab which version of Elixir are you running on your Localhost vs. Heroku?
@nelsonic
Localhost: Elixir 1.3.4
from elixir_buildpack:
erlang_version=18.3
elixir_version=1.3.4
always_rebuild=false
runtime_path=/app
The phoenix version is defined on the mix.exs and is phoenix, "~> 1.2.1"
so it should be the same on localhost and Heroku
Not a blocker anymore as I'm creating a switch to parse the payload properly depending on its format. But I still would like to understand the source of the problem :worried:
Ok, just being silly!!
When you create a webhooks check that select the right content type!! "application/json" and not "application/x-www-form-urlencoded"
I will remember this one now!
@SimonLab this should be included in the readme/instructions for setting up web hooks...
Some context: Each time an event appears on Github (new label, new issue,...) my server receive a POST request from Github with all the information of the event store in the payload (body) of the request. The format of the paylod seems however different on my loacalhost and on Heroku:
On Heroku the payload received is already parse to Json:
On localhost the payload as the following format:
The the first one is a json object, the second one is also a json object but with just one property "payload" which has for value the stringify response. Which means that on localhost I need to use Poinon.decode to parse the value but this will break on production has the value is already parsed.
I've also deploy an hapi server on Heroku to see the format of the payload and it match the second version;
I'm not entirely sure why this difference exists and where it comes form, is it the way Github send the payload? Is it an option on Phoenix to parse automatically the payload on production but not on developement? Does anyone has any suggestion to help me understand how Phoenix manage the payload of a post request and why there is this difference in the format of the payload?