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

Upgrading to 2.15 and above results in 404 when used in webhook mode #743

Open
wernerb opened this issue Jan 21, 2025 · 9 comments · Fixed by #745
Open

Upgrading to 2.15 and above results in 404 when used in webhook mode #743

wernerb opened this issue Jan 21, 2025 · 9 comments · Fixed by #745
Labels
bug Something isn't working

Comments

@wernerb
Copy link

wernerb commented Jan 21, 2025

Problem Description

Updated the image to 2.15, noticed that the webhooks are not arriving and get a 404 instead. No changes were made except a move from 2.15.rc1 to 2.15

What is actually happening

It appears that the dependency updates are breaking.

What is the expected behavior

Webhooks process normally

Error output, if available

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /</pre>
</body>
</html>```

## Context

### Are you using the hosted instance of probot/settings or running your own?
Running my own 

### If running your own instance, are you using it with github.com or GitHub Enterprise?
Github enterprise 

#### Version of probot/settings

#### Version of GitHub Enterprise
@wernerb wernerb added the bug Something isn't working label Jan 21, 2025
@PendaGTP
Copy link
Contributor

PendaGTP commented Jan 22, 2025

@wernerb This issue may be related to the probot upgrade from 12.3.4 to 13.3.8, which includes breaking changes (see: https://github.com/probot/probot/releases/tag/v13.0.0).

One notable change is that the default webhookPath is now /api/github/webhooks.
As a quick possible fix, try set this environment variable: WEBHOOK_PATH=/

I'll investigate further to confirm this is the cause.

@wernerb
Copy link
Author

wernerb commented Jan 22, 2025

I can change the path in our github app settings to /api/github/webhooks I will try.

@wernerb
Copy link
Author

wernerb commented Jan 22, 2025

Changing path had other side effects that rulesets for example are not processed anymore. A PR comment is now created that says no changes 0 repo's considered

@PendaGTP
Copy link
Contributor

PendaGTP commented Jan 22, 2025

Potential solution: downgrading probot to version 12.3.4. While I haven't tested, I will investigate and do some testing when I have time.

@wernerb
Copy link
Author

wernerb commented Jan 22, 2025

So the current stable tag is not working at all currently. @decyjphr I appreciate your work but this is a massive bug, can you pull the release, or are you planning to fix forward?

@decyjphr
Copy link
Collaborator

Thanks @PendaGTP I'll revert to probot 12.3.4

@decyjphr
Copy link
Collaborator

@wernerb I built 2.1.16 which has the probot reverted. Please let me know if we can close this issue.

@decyjphr decyjphr reopened this Jan 22, 2025
@PendaGTP
Copy link
Contributor

@decyjphr (@wernerb)

I've done additional investigation and testing on both 2.15 and 2.15-rc.1.
As already said, the safe-settings version 2.15 updates the probot package from 12.3.4 to 13.3.8.

Here are the changes that need consideration:

  1. Configure safe-settings with the new default webhook path:

    • Update the GitHub app webhook URL to include /api/github/webhooks
    • Or set the environment variable WEBHOOK_PATH to / on the deployed app
    • Update the documentation
  2. Review usage of probot.log in the code:

    • probot.log is now a pino logger instance, not a function
    • Current usage throws the error this.log is not a function (in rulesets, branches, and validator plugins)
    • This needs to be updated to probot.log.info, probot.log.error, etc.

I've tested these changes and confirmed they work as expected on v2.15 (set webhook path via github app or env var + refactor usage of this.log)

Notes:

  • No changes needed for serverless deployments since the documentation already specifies the webhook path (/api/github/webhooks)
  • Testing focused primarily on the Rulesets plugin, not all cases

@decyjphr, thoughts on this? I can open a PR with my proposed changes.

Let me know if anything needs clarification.

@decyjphr
Copy link
Collaborator

@PendaGTP Great work in debugging this!

So because probot changed the default webhookPath from / to /api/github/webhooks, users would have to change the webhook url in the app configuration to include /api/github/webhooks or alternatively they can leave the configuration as-is but set the webhookPath env variable to /.

I would be grateful if you are able to update the docs to indicate this and thank you for having a fix for probot.log changes in the newer version. So go for it!

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants