mattermost-plugin-github icon indicating copy to clipboard operation
mattermost-plugin-github copied to clipboard

How to troubleshoot?

Open alexander-potemkin opened this issue 1 year ago • 12 comments

Thank you for the plugin, it's really an important piece of software! My problem is that every time I have to configure it - it's a pain, if doesn't work from the first setup (which happens rarely).

/github setup is a huge help, but how do I troubleshoot when it doesn't work?

I've setup oauth app, webhook, I can see that webhook reaches my server, get 200 code and I can even see mattermost server webhook extension DEBUG logging that it received webhook. But I can't see it in the channel, where I did /github subscribe myorganization (and verified with /github subscriptions list) - I have no ideas how to understand where things went wrong.

I've spent like 1.5 hours on that already and I would really appreciate any help you could offer!

alexander-potemkin avatar Feb 23 '24 13:02 alexander-potemkin

Not sure what is different, but since I re-setup everything once again, I'm not getting the following error:

{
  "caller": "app/plugin_api.go:1006",
  "error": "GET https://api.github.com/repos/myorg/api-server: 404 Not Found []",
  "level": "warn",
  "msg": "Failed fetch repository to check permission",
  "plugin_id": "github",
  "timestamp": "2024-02-23 12:57:58.648 Z"
}

Any ideas what could it be? And how do I troubleshoot this?

alexander-potemkin avatar Feb 23 '24 13:02 alexander-potemkin

Hi @alexander-potemkin, apologies for the late response. Were you able to resolve this?

Is this repository you had an issue with there a private repository? GitHub will return a 404 like this if the user doesn't have access to the repository, or if the repository is spelled incorrectly.

mickmister avatar May 30 '24 22:05 mickmister

@mickmister , no, not really... Thanks for letting me know.

Repo name has been copy-pasted and I'm trying to access from my account, which surely has access to the repos (since I'm the owner).

I've spend some time trying to troubleshoot this, but it seems like I don't have that many tools for that - is there something you can help me with?

alexander-potemkin avatar May 31 '24 08:05 alexander-potemkin

@alexander-potemkin So the plugin allows you to create a subscription, but the webhook events don't work? Do other features of the plugin work, like creating issues?

@Kshitij-Katiyar Do you have any ideas on what can be done to troubleshoot here?

mickmister avatar May 31 '24 13:05 mickmister

@mickmister , that's right.

We don't use issues and etc. - so I can't even comment on that... Happy to execute any command required and revert back with results, thought!

alexander-potemkin avatar Jun 01 '24 11:06 alexander-potemkin

@alexander-potemkin Are you able to try in different Mattermost environment?

If you've verified the webhook request is being received, and there are no debug logs for any errors or issues with the request, it's possible the event configuration on the webhook may be incorrect?

and I can even see mattermost server webhook extension DEBUG logging that it received webhook.

Can you verify that the request is logged when you perform a user action in GitHub that you want to capture? e.g. Creating an issue in GitHub, and see if you Mattermost server received the request for that

mickmister avatar Jun 04 '24 14:06 mickmister

@alexander-potemkin While creating the webhook, have you selected Content Type: application/json in the subscription you have created, and the event you are doing on GitHub should be the same as if your subscription has a pull_request attribute, then this will accept open/closing of the pull_request. And you check that when you have closed a pull_request, the event is being sent by the webhook on GitHub or not.

Kshitij-Katiyar avatar Jun 04 '24 15:06 Kshitij-Katiyar

@Kshitij-Katiyar , @mickmister , thank you very much for all your suggestions! It's definetely application/json - I can see at GitHub side deliveries's headers to contain Content-Type: application/json. We don't normally use pull requests - just direct commits to the main branch; github is full of the events being delivered to my server, the responce is 200, but nothing on Mattermost side... And I don't know how to debug that part - how do I see that particular even on Mattermost server?

alexander-potemkin avatar Jun 14 '24 18:06 alexander-potemkin

@mickmister I was looking at the code, There is a field in plugin config struct EnableWebhookEventLogging, which basically dumps the webhook event to the logs. But some for reason this plugin setting is not present in the settings schema in the plugin.json file. That's why it is not present in the UI of the plugin configuration. I think that setting could be beneficial here as we can check all about the webhook events from the logs on the mattermost side. https://github.com/mattermost/mattermost-plugin-jira/blob/dea71eb0e977151b0c94932a6e1895e95590c414/server/plugin.go#L80

Kshitij-Katiyar avatar Jun 17 '24 11:06 Kshitij-Katiyar

@alexander-potemkin Are you able to edit your server's configuration file? If so, can you try putting this in your configuration?

At PluginSettings.Plugins.github:

{
    "enablewebhookeventlogging": false,
    // ... other fields
}

@alexander-potemkin Are you able to run /github subscriptions list and provide what features are being used in your subscription?

mickmister avatar Jun 19 '24 04:06 mickmister

@mickmister , sure - done - please, see attached.

Screenshot 2024-06-24 at 23 31 33 Screenshot 2024-06-24 at 23 33 27

alexander-potemkin avatar Jun 24 '24 20:06 alexander-potemkin

We don't normally use pull requests - just direct commits to the main branch; github is full of the events being delivered to my server, the responce is 200, but nothing on Mattermost side.

I see pushes is in the subscription :+1:

@alexander-potemkin Are you able to enable webhook logging and test what's coming in for commit events? Also have you verified the webhook is configured to send commit events? Thanks @alexander-potemkin

mickmister avatar Jun 26 '24 18:06 mickmister

@alexander-potemkin Are you able to debug this? because we would like to close the issue.

Kshitij-Katiyar avatar Jul 17 '24 14:07 Kshitij-Katiyar

Closing this issue. Can reopen if someone is still facing the issue

raghavaggarwal2308 avatar Jul 31 '24 10:07 raghavaggarwal2308