Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gith responding to github with status 200 but callback not called. #20

Open
joshjhargreaves opened this Issue Aug 20, 2014 · 12 comments

Comments

Projects
None yet
@joshjhargreaves
Copy link

joshjhargreaves commented Aug 20, 2014

I have beem attempting to implement git hooks with gith have had no luck.
Even the very simple example below does not behave as I would expect.
Status code 200 is being returned to github, so the gith server
is obviously running, but the callback is not ever being called.

var gith = require('gith').create(9004); // ensure to match the port you entered in Github

gith().on( 'all', function( payload ) {
  console.log( 'Post-receive happened!' );
});

For the record I'm using Ubuntu 14.04 x64

@drGrove

This comment has been minimized.

Copy link

drGrove commented Aug 21, 2014

I am also noticing this issue.

@dneff

This comment has been minimized.

Copy link

dneff commented Aug 26, 2014

I ran into this issue when using github enterprise. I'm also using Ubuntu 14.04.

I'm not sure if the webhooks are formatted differently for GH:E, but in digging through the lib/gith.js, it looks like these lines (starting at 247) are the problem:

    if ( /^payload=/.test( data ) ) {
        var payload = JSON.parse( querystring.unescape(data.slice(8)) );

There is no payload= in my webhook response, so I changed it to this:

    if ( data ) {
        var payload = JSON.parse( querystring.unescape(data) );

after that, it works great. Perhaps the solution is to test for payload= and trim it conditionally:

    if ( data ) {
        data = data.replace(/^payload=/,"");
        var payload = JSON.parse( querystring.unescape(data) );
@gauntface

This comment has been minimized.

Copy link

gauntface commented Sep 2, 2014

+1 on seeing the same behaviour.

Can also confirm the above comment fixes the issue.

iconix added a commit to iconix/tn that referenced this issue Sep 19, 2014

@emanuil

This comment has been minimized.

Copy link

emanuil commented Dec 17, 2014

+1 for fixing this

@billautomata

This comment has been minimized.

Copy link

billautomata commented Jan 7, 2015

I'm still seeing this.

@operatino

This comment has been minimized.

Copy link

operatino commented Jan 20, 2015

Same here. Seems like a project is dead...

@murphyj

This comment has been minimized.

Copy link

murphyj commented Feb 7, 2015

I'm also seeing this problem. Github is telling me it's fired correctly and i'm definitely listening to the push event but it's not logging out. I'm also using Ubuntu 14.04

@dcharbonnier

This comment has been minimized.

Copy link

dcharbonnier commented Feb 14, 2015

Are use using the correct content type ?
image

@itsamenathan

This comment has been minimized.

Copy link

itsamenathan commented Feb 17, 2015

@dcharbonnier changing to that content type seems to work correctly. Though I would think this should work with the default settings on github.

@murphyj

This comment has been minimized.

Copy link

murphyj commented Mar 3, 2015

@dcharbonnier thanks for getting back to me. I couldn't get it working so I opted for a much simpler hand-crafted Sinatra app.

Out of interest what's the benefit of using gith over something like a lightweight Sinatry app aside from the fact that you don't have to ensure a separate process is running?

@nicbou

This comment has been minimized.

Copy link

nicbou commented Aug 21, 2015

If gith doesn't properly handle the format, it should return an appropriate status code, or at least provide some sort of feedback.

@maximilliangeorge

This comment has been minimized.

Copy link

maximilliangeorge commented Nov 4, 2015

I was also having trouble with this. Changing the content type to application/x-www-form-urlencoded fixed this issue! Thanks @dcharbonnier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.