matrix-org / matrix-hookshot

A bridge between Matrix and multiple project management services, such as GitHub, GitLab and JIRA.
https://matrix-org.github.io/matrix-hookshot/
Apache License 2.0
267 stars 66 forks source link

404 Cannot POST error from GitLab #940

Open artooro opened 1 month ago

artooro commented 1 month ago

Currently running hookshot v5.3.0.

I configured the GitLab integration and bridged a room using the message.

!hookshot gitlab project https://git.example.com/group/project

It successfully created the webhook in the GitLab project, but when testing it, GitLab gets an HTTP 404 error with a body of

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

I have debug logging enabled for hookshot, and the only log message that it outputs is

DEBUG 20:36:18:998 [Webhooks] Verified GitLab request

So I am not finding any errors in hookshot, and bot is making API calls to GitLab successfully, and I haven't been able to figure out why it's responding with a Cannot POST message.

Here are the relevant configs. Of which the generic webhooks are working fine. It's only GitLab that I'm having an issue with.

hookshot config

bridge:
  domain: example.com
  url: http://10.1.2.3:8008
  mediaUrl: https://matrix.example.com
  port: 9993
  bindAddress: 0.0.0.0

gitlab:
  instances:
    git.example.com:
      url: https://git.example.com
  webhook:
    secret: ABCD1234567-ABCD1234567-ABCD1234567
    publicUrl: https://matrix.example.com/hookshot/gitlab/
  userIdPrefix: _gitlab_

generic:
  enabled: true
  enableHttpGet: false
  urlPrefix: https://matrix.example.com/webhook/
  userIdPrefix: _webhooks_
  allowJsTransformationFunctions: false
  waitForComplete: false

feeds:
  enabled: true
  pollConcurrency: 4
  pollIntervalSeconds: 600
  pollTimeoutSeconds: 30

bot:
  displayname: Bot

passFile: /data/passkey.pem

listeners:
  - port: 9000
    bindAddress: 0.0.0.0
    resources:
      - webhooks

logging:
  level: debug

Reverse Proxy config

I'm using Caddy server for the reverse proxy, it has the following config.

matrix.example.com {
  reverse_proxy /_matrix/* localhost:8008
  reverse_proxy /_synapse/client/* localhost:8008

  reverse_proxy /webhook* localhost:9000
  reverse_proxy /hookshot/gitlab* localhost:9000
}

Considering the request is getting to hookshot based on it's DEBUG log entry, I don't think the reverse proxy is the issue.