matrix-webhook-gateway
matrix-webhook-gateway copied to clipboard
Bot does not accept invitation
Hello! I checked everything, the bot is accessible from the synapse container: docker compose exec synapse curl 172.118.0.1:8023/health OK In the bot logs there is this error:
matrix-webhooks-1 | 2025-04-24 08:08:26.815 INFO [webhook-srv] Matrix bridge running on 0.0.0.0:8023 matrix-webhooks-1 | 2025-04-24 08:08:26.840 ERROR [knex] MatrixHttpClient (REQ-1) matrix-webhooks-1 | { matrix-webhooks-1 | errcode: 'M_USER_IN_USE', matrix-webhooks-1 | error: 'User ID already taken.' matrix-webhooks-1 | } matrix-webhooks-1 | 2025-04-24 08:08:26.884 WARN [webhook-srv] Plugin directory '/app/plugins' does not exist. No plugins will be loaded. matrix-webhooks-1 | 2025-04-24 08:08:26.885 INFO [webhook-srv] Web server running on 0.0.0.0:8020
As far as I can tell, that M_USER_IN_USE is 'normal' behaviour from the Matrix client, so that likely isn't the issue.
At the very least, it indicates that the bot is able to access your Synapse server.
Your Synapse logs might contain more information here. If you invite the bot, it should attempt to push the invitation event back to the gateway app service. If that doesn't work, it will log the failure, which will look somewhat like this:
synapse-1 | 2025-04-24 15:54:56,751 - synapse.appservice.api - 389 - WARNING - as-recoverer-webhook-dev-0 - push_bulk to http://172.31.0.1:8023 threw exception(ConnectionRefusedError) Connection was refused by other side: 111: Connection refused. args=('Connection refused',)
synapse-1 | 2025-04-24 15:54:56,751 - synapse.appservice.scheduler - 487 - INFO - as-recoverer-webhook-dev-0 - Scheduling retries on webhook-dev in 4.000000s
synapse-1 | 2025-04-24 15:55:00,752 - synapse.appservice.scheduler - 497 - INFO - as-recoverer-webhook-dev-1 - Starting retries on webhook-dev
synapse-1 | 2025-04-24 15:55:00,753 - synapse.appservice.scheduler - 506 - INFO - as-recoverer-webhook-dev-1 - Retrying transaction 1 for AS ID webhook-dev
synapse-1 | 2025-04-24 15:55:01,055 - synapse.http.client - 423 - INFO - as-recoverer-webhook-dev-1 - Error sending request to PUT http://172.31.0.1:8023/_matrix/app/v1/transactions/1: ConnectionRefusedError Connection refused
``
I have the following messages in the logs:
2025-04-25 09:18:11,455 - synapse.appservice.scheduler - 509 - INFO - as-recoverer-3 - Retrying transaction 1 for AS ID webhook-gateway
2025-04-25 09:18:11,463 - synapse.http.client - 442 - INFO - as-recoverer-3 - Received response to PUT http://172.118.0.1:8023/_matrix/app/v1/transactions/1: 403
2025-04-25 09:18:11,464 - synapse.appservice.api - 404 - WARNING - as-recoverer-3 - push_bulk to http://172.118.0.1:8023 received code=403 msg=Forbidden
2025-04-25 09:18:11,464 - synapse.appservice.scheduler - 488 - INFO - as-recoverer-3 - Scheduling retries on webhook-gateway in 32.000000s
I'm having the same issue on a fresh install. Were you able to fix this problem?
I'm not sure of the cause, I haven't been able to reproduce this issue locally.
Just wanted to chime in that I'm getting the same errors:
2025-06-21 21:47:28,453 - synapse.appservice.api - 404 - WARNING - as-recoverer-8 - push_bulk to http://10.10.1.11:8023 received code=403 msg=Forbidden
For context I'm running the webhook gateway via docker on a separate machine from the Synapse server. My config and data directories are mounted via docker volume mounts and are set to be owned by user/group 953.
@geluk Are there things I can attempt on my setup to get you more information or help debug?
@geluk I'm also experiencing the 403 "Forbidden" error on a fresh install.
My docker-compose.yml file is the following:
name: services
services:
### --- Matrix --- ###
Matrix:
image: matrixdotorg/synapse:latest
container_name: Matrix
network_mode: host
restart: unless-stopped
environment:
UID: ${Device_UserID}
TZ: ${Device_Timezone}
GID: ${Device_GroupID}
VIRTUAL_PORT: ${Matrix_Port}
VIRTUAL_HOST: ${Matrix_Domain}
LETSENCRYPT_HOST: ${Matrix_Domain}
SYNAPSE_SERVER_NAME: ${Matrix_Domain}
SYNAPSE_REPORT_STATS: ${Matrix_ReportStats}
volumes:
- /home/zach/docker/config/services/Matrix:/data:rw
### --- Matrix (Webhooks) --- ###
Matrix-Webhooks:
image: geluk/matrix-webhook-gateway:latest
container_name: Matrix-Webhooks
network_mode: host
restart: unless-stopped
environment:
WEBHOOK_CONFIG: /config/gateway-config.yaml
WEBHOOK_APPSERVICE_CONFIG: /data/appservice-webhook-gateway.yaml
volumes:
- /home/zach/docker/config/services/Webhook-Data:/data:rw
- /home/zach/docker/config/services/Webhook-Config:/config:rw
After I invite the bot to a matrix room, I see the following within my docker synapse logs. I have highlighted the sections where the "403 Forbidden" error message is occurring.
2025-06-24 17:18:16,270 - synapse.appservice.scheduler - 532 - INFO - as-recoverer-4 - Starting retries on webhook-gateway
2025-06-24 17:18:16,271 - synapse.appservice.scheduler - 541 - INFO - as-recoverer-4 - Retrying transaction 1 for AS ID webhook-gateway
**2025-06-24 17:18:16,277 - synapse.http.client - 442 - INFO - as-recoverer-4 - Received response to PUT http://192.168.2.14:8023/_matrix/app/v1/transactions/1: 403**
**2025-06-24 17:18:16,278 - synapse.appservice.api - 404 - WARNING - as-recoverer-4 - push_bulk to http://192.168.2.14:8023/ received code=403 msg=Forbidden**
2025-06-24 17:18:16,278 - synapse.appservice.scheduler - 505 - INFO - as-recoverer-4 - Scheduling retries on webhook-gateway in 64.000000s
2025-06-24 17:18:17,740 - twisted - 279 - INFO - sentinel - Timing out client: IPv6Address(type='TCP', host='::ffff:172.17.0.1', port=34012, flowInfo=0, scopeID=0)
2025-06-24 17:18:17,741 - twisted - 279 - INFO - sentinel - Timing out client: IPv6Address(type='TCP', host='::ffff:172.17.0.1', port=33998, flowInfo=0, scopeID=0)
I have ran the following command and the status check came back as "OK":
docker compose exec Matrix curl 192.168.2.14:8023/health