Organizations Are Missing Webhooks #1647
Comments
Just ran the
NextWe should notify classrooms that don’t have webhooks to authorize the right token. |
Possible Solution:Right now, webhooks are dependant on users OAuth tokens. This isn't great because users can revoke their tokens, or leave the organization, leaving the tokens on record as invalid. It turns out we can use the classroom OAuth app token to create webhooks:
If we use the classroom client OAuth token to create webhooks then we can ensure that every organization has webhooks enabled. |
@BenEmdon What do you think about renaming this issue to include "Importing starter code taking a long time" or something like that so people know that it's related to this problem? That could help redirect people here as they run into issues |
I'd like to keep the development track and incident reports separate so we can filter out the noise 😕 Maybe I should start a master issue for all the incidents? |
That totally makes sense! I think we can open up another pinned issue just for the incidents and include some instructions on what to do if people hit this issue. Hopefully that makes it a bit easier to sort through |
Pinned #1778 |
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
Interesting; hooks created by the OAuth app cannot be seen by users. And hooks created by users cannot be seen by the Oauth app. |
UpdateSo after investigating the API, it turns out that OAuth apps can't use their own token to register web hooks. 😔 This means that we will have to continue to use user tokens to register webhooks. Steps forward
|
UpdateRan the PRODUCTION [1] pry(main)> OrganizationWebhook.where(github_id: nil).count
=> 3674 The 3674 Organizations without WebhooksThese organizations are missing webhooks for one of two reasons:
We can't do anything about case 2, but we can let each classroom know that they are missing a user with the the |
This issue could be resolved if Classroom became a GitHub app #2049 |
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
From running the following query on production, it is evident that there are still a significant amount of
Organizations
that are missing webhooks:This number excludes
Organizations
that have awebhook_id
but who's webhooks are deleted or inactive.The source of this problem
The problem occurred when we introduced webhooks back in #797, we forgot to backfill organizations created before the change with web hooks.
Why this is important
All
Organizations
require webhooks to perform starter code imports as we rely on therepository_import
event.Steps to ensure all Organizations have webhooks that are active
OrganizationWebhook
model to manage multiple classrooms (Organization webhook migration #1692 Organization webhook #1694)is_webhook_active
column onOrganization
to reflect the last webhook delivered as a date (move this toOrganizationWebhook
) ( Updates last_webhook_recieved for every webhook event #1696)Organization
s to belong to aOrganizationWebhook
(Organization webhook model backfill #1695)GitHubOrganizationWebbhook
as aGitHubResource
(GitHubOrgHook GitHubResource #1702)OrganizationWebhook
has a valid webhook (Migration to ensure every organization has valid webhooks #1718)Organization::Creator
toGitHubOrganizationWebhook
(Create organization with organization webhook logic #1716)Steps to ensure an org is in good healthOrganization
meets all minimum requirements (Added method #in_good_health? to organization model #1724)if a user in the org has all the scopes neededdisable classrooms that are in bad healthmigration to removeOrganizationWebhook
github_id
s that aren't active.Switch all webhooks to app created webhooksmigration to switch allOrganizationWebhook
from user created webhooks to OAuth app generated webhooksuseGitHubClassroom.github_client
to create organization webhooks instead of user clientsDo what we can with what we have
ensure_webhook_is_active!
on allOrganizationWebhooks
classroom/app/models/organization_webhook.rb
Lines 78 to 99 in d5d7a9a
The text was updated successfully, but these errors were encountered: