Webhook doesn't work

Issue #39 resolved
Viktor Gjorgonoski created an issue

Hi, I installed and configured according to the documentation, and the initial full deployment works. However the gateway hook doesn't work. From the bitbucket side is fine I do get the requests but it doesn't update the code. If I put the deploy script instead then it works, but doesn't that mean that it downloads the whole code? I also tried to open the url manually and don't get any output. With the ?test option I do get a confirmation that the files are writable.

Comments (9)

  1. Manish Motwani

    Experiencing the same issue as @viktorce, deploy works when executed directly from the browser, but not when setup using webhook with gateway.php Followed all the instructions and viewed the existing issues as well.

  2. Alexandru Lixandru repo owner

    I don't understand what the issue is. Do you have files in your commits folder? If yes, then your deployment does not start automatically. Check config file for 'automaticDeployment' variable.

  3. Viktor Gjorgonoski reporter

    gateway.php hook doesn't work. From bitbucket I can see that it got a 200 response, but deployment doesn't happen. My webhook is pointing towards gateway.php. Weird enough deploy.php with parameters for full deployment works, either manually or as a webhook. Automatic deployment is set to true. But yes there are files and folders in the commit folder. Should it be empty for gateway.php to work?

  4. Alexandru Lixandru repo owner

    OK, let me explain a bit the structure of this project to make sure we're all on the same page. This project consists of 2 scripts: gateway.php and deploy.php. Their purpose is the following:

    • gateway.php: receives the POST request from BitBucket and creates a file in 'commits' folder, with all commit meta-data (important - you need to use POST service - the deprecated one, not the new webhooks!! this script does not work with the new webhooks API)
    • deploy.php: takes the files from commits folder and processes them (does actual deployment of files).

    These 2 scripts do different things and it is possible to chain their actions (i.e. if automaticDeployment is set to true).

    Now, you say that gateway.php does not work - this means no files are created in the commits folder. If this is the case, please check your error log and (VERY important!) make sure you are using POST service, not webhooks.

    Please confirm you understand what I just posted and that you are using POST service (under Services), and not Webhooks.

  5. Manish Motwani

    Okay, I got it now. I was using new webhook API assuming it will replace the old POST service. With the new webhook API I receive nothing in POST/GET/REQUEST in gateway,php file. Thanks a log for this library and detailed answer.

  6. Alexandru Lixandru repo owner

    The webhooks service is different from POST service and provides different data in the payload, which is insufficient for this script's way of operating (namely list of modified files). This makes this script unusable with webhooks.

    As long as the POST service is still provided by Bitbucket, this script will continue to function properly (using POST service integration), but a port to the new webhooks service WILL NOT be implemented.

  7. Log in to comment