matrix-org / matrix-hookshot

A bridge between Matrix and multiple project management services, such as GitHub, GitLab and JIRA.

Home Page:https://matrix-org.github.io/matrix-hookshot/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Join dynamic github room not fully sucessful

yncyrydybyl opened this issue · comments

I am trying to join a dynamic github issue room.
The room name is #github_yncyrydybyl_nothing_3:datanauten.de. That should point to yncyrydybyl/Nothing#3.

The room is created. Topic and Avatar also fetched and set sucessfully. But then nothing in the rooms happens.
If I write messages these are not passed to the github issue. And when something is commented in the issue it also not shown in the room.

The log on creation looks like:


INFO 20:00:48:725 [Bridge] Got room query request: #github_yncyrydybyl_nothing_4:datanauten.de
INFO 20:00:48:725 [GitHubIssueConnection] Fetching yncyrydybyl/nothing/4
INFO 20:00:49:920 [GitHubIssueConnection] uploading https://avatars.githubusercontent.com/u/104430?v=4
INFO 20:00:52:978 [Appservice] Processing transaction 1928256
INFO 20:00:52:979 [Appservice] Processing event of type m.room.create
INFO 20:00:52:980 [Appservice] 172.18.0.4 - - [10/Dec/2023:20:00:52 +0000] "PUT /_matrix/app/v1/transactions/1928256? HTTP/1.1" 200 2 "-" "Synapse/1.97.0"
INFO 20:00:54:321 [Appservice] Processing transaction 1928257
INFO 20:00:54:322 [Appservice] Processing event of type m.room.member
DEBUG 20:00:54:322 [BotUsersManager] Bot user @hookshot:datanauten.de joined room !niJRWduYuSZTIoTFAj:datanauten.de
INFO 20:00:54:324 [Appservice] 172.18.0.4 - - [10/Dec/2023:20:00:54 +0000] "PUT /_matrix/app/v1/transactions/1928257? HTTP/1.1" 200 2 "-" "Synapse/1.97.0"
DEBUG 20:00:54:653 [MatrixHttpClient] (REQ-361) { errcode: 'M_NOT_FOUND', error: 'Room account data not found' } 
DEBUG 20:00:54:653 [MatrixClient] Error getting uk.half-shot.matrix-hookshot.github.room room account data in !niJRWduYuSZTIoTFAj:datanauten.de: { errcode: 'M_NOT_FOUND', error: 'Room account data not found' } 
INFO 20:00:54:653 [ConnectionManager] Removing all connections from !niJRWduYuSZTIoTFAj:datanauten.de
INFO 20:00:56:811 [Appservice] 172.18.0.4 - - [10/Dec/2023:20:00:56 +0000] "GET /_matrix/app/v1/rooms/%23github_yncyrydybyl_nothing_4%3Adatanauten.de? HTTP/1.1" 200 568 "-" "Synapse/1.97.0"
INFO 20:00:57:042 [Appservice] Processing transaction 1928258
INFO 20:00:57:042 [Appservice] Processing event of type m.room.power_levels
INFO 20:00:57:043 [Appservice] 172.18.0.4 - - [10/Dec/2023:20:00:57 +0000] "PUT /_matrix/app/v1/transactions/1928258? HTTP/1.1" 200 2 "-" "Synapse/1.97.0"
INFO 20:00:57:293 [Appservice] Processing transaction 1928259
INFO 20:00:57:294 [Appservice] Processing event of type m.room.canonical_alias
INFO 20:00:57:294 [Appservice] Processing event of type m.room.join_rules
INFO 20:00:57:294 [Appservice] Processing event of type m.room.history_visibility
INFO 20:00:57:295 [Appservice] Processing event of type uk.half-shot.matrix-hookshot.github.issue
DEBUG 20:00:57:295 [GitHubIssueConnection] Syncing issue state for !niJRWduYuSZTIoTFAj:datanauten.de
INFO 20:00:57:297 [Appservice] Processing event of type m.room.avatar
INFO 20:00:57:297 [Appservice] Processing event of type m.room.name
ERROR 20:00:57:298 [ConnectionManager] Not creating connection for state !niJRWduYuSZTIoTFAj:datanauten.de/uk.half-shot.matrix-hookshot.github.issue TypeError: Cannot read properties of undefined (reading 'toLowerCase')
    at get org [as org] (/usr/bin/matrix-hookshot/Connections/GithubIssue.js:144:31)
    at GitHubIssueConnection.syncIssueState (/usr/bin/matrix-hookshot/Connections/GithubIssue.js:186:64)
    at GitHubIssueConnection.createConnectionForState (/usr/bin/matrix-hookshot/Connections/GithubIssue.js:44:21)
    at ConnectionManager.createConnectionForState (/usr/bin/matrix-hookshot/ConnectionManager.js:174:53)
    at Bridge.onRoomEvent (/usr/bin/matrix-hookshot/Bridge.js:834:65) 
    at Appservice.<anonymous> (/usr/bin/matrix-hookshot/Bridge.js:152:25)
    at Appservice.emit (node:events:514:28)
    at Appservice.emit (node:domain:488:12)
    at Appservice.handleTransaction (/usr/bin/matrix-hookshot/node_modules/matrix-bot-sdk/lib/appservice/Appservice.js:583:18)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Appservice.onTransaction (/usr/bin/matrix-hookshot/node_modules/matrix-bot-sdk/lib/appservice/Appservice.js:628:13)
INFO 20:00:57:299 [Appservice] Processing event of type m.room.topic
INFO 20:00:57:300 [Appservice] 172.18.0.4 - - [10/Dec/2023:20:00:57 +0000] "PUT /_matrix/app/v1/transactions/1928259? HTTP/1.1" 200 2 "-" "Synapse/1.97.0"
INFO 20:00:59:878 [Appservice] Processing transaction 1928260
INFO 20:00:59:878 [Appservice] Processing event of type m.room.member
INFO 20:00:59:879 [Appservice] 172.18.0.4 - - [10/Dec/2023:20:00:59 +0000] "PUT /_matrix/app/v1/transactions/1928260? HTTP/1.1" 200 2 "-" "Synapse/1.97.0"

Looks like some information was missing, which caused the error. uk.half-shot.matrix-hookshot.github.issue needs to be created or the bridge will ignore the room.

I think it is missing the org. Maybe

const orgRepoName = issue.repository?.full_name;
is not working in that case?

Yes, the required properties org and repo are missing.

{
    "comments_processed": -1,
    "issues": [
      "4"
    ],
    "state": "open"
}

The linked line should validate Github's API response to ensure a valid state event is set.