Page MenuHomeDevCentral

organization.member_invited GitHub event triggers a 500
Open, NormalPublic

Description

Should be handled as administrative event, ie an avent independent from a repository. Instead, we got a 500 error.

Payload example:

1{
2 "action": "member_invited",
3 "invitation": {
4 "id": 57083161,
5 "node_id": "OI_kwDOAFWIqs4DZwUZ",
6 "login": "aceppaluni",
7 "email": null,
8 "role": "direct_member",
9 "created_at": "2024-10-08T20:59:47.000+02:00",
10 "failed_at": null,
11 "failed_reason": null,
12 "inviter": {
13 "login": "dereckson",
14 "id": 135563,
15 "node_id": "MDQ6VXNlcjEzNTU2Mw==",
16 "avatar_url": "https://avatars.githubusercontent.com/u/135563?v=4",
17 "gravatar_id": "",
18 "url": "https://api.github.com/users/dereckson",
19 "html_url": "https://github.com/dereckson",
20 "followers_url": "https://api.github.com/users/dereckson/followers",
21 "following_url": "https://api.github.com/users/dereckson/following{/other_user}",
22 "gists_url": "https://api.github.com/users/dereckson/gists{/gist_id}",
23 "starred_url": "https://api.github.com/users/dereckson/starred{/owner}{/repo}",
24 "subscriptions_url": "https://api.github.com/users/dereckson/subscriptions",
25 "organizations_url": "https://api.github.com/users/dereckson/orgs",
26 "repos_url": "https://api.github.com/users/dereckson/repos",
27 "events_url": "https://api.github.com/users/dereckson/events{/privacy}",
28 "received_events_url": "https://api.github.com/users/dereckson/received_events",
29 "type": "User",
30 "site_admin": false
31 },
32 "team_count": 1,
33 "invitation_teams_url": "https://api.github.com/organizations/5605546/invitations/57083161/teams",
34 "invitation_source": "member"
35 },
36 "user": {
37 "login": "aceppaluni",
38 "id": 113948612,
39 "node_id": "U_kgDOBsq3xA",
40 "avatar_url": "https://avatars.githubusercontent.com/u/113948612?v=4",
41 "gravatar_id": "",
42 "url": "https://api.github.com/users/aceppaluni",
43 "html_url": "https://github.com/aceppaluni",
44 "followers_url": "https://api.github.com/users/aceppaluni/followers",
45 "following_url": "https://api.github.com/users/aceppaluni/following{/other_user}",
46 "gists_url": "https://api.github.com/users/aceppaluni/gists{/gist_id}",
47 "starred_url": "https://api.github.com/users/aceppaluni/starred{/owner}{/repo}",
48 "subscriptions_url": "https://api.github.com/users/aceppaluni/subscriptions",
49 "organizations_url": "https://api.github.com/users/aceppaluni/orgs",
50 "repos_url": "https://api.github.com/users/aceppaluni/repos",
51 "events_url": "https://api.github.com/users/aceppaluni/events{/privacy}",
52 "received_events_url": "https://api.github.com/users/aceppaluni/received_events",
53 "type": "User",
54 "site_admin": false
55 },
56 "organization": {
57 "login": "nasqueron",
58 "id": 5605546,
59 "node_id": "MDEyOk9yZ2FuaXphdGlvbjU2MDU1NDY=",
60 "url": "https://api.github.com/orgs/nasqueron",
61 "repos_url": "https://api.github.com/orgs/nasqueron/repos",
62 "events_url": "https://api.github.com/orgs/nasqueron/events",
63 "hooks_url": "https://api.github.com/orgs/nasqueron/hooks",
64 "issues_url": "https://api.github.com/orgs/nasqueron/issues",
65 "members_url": "https://api.github.com/orgs/nasqueron/members{/member}",
66 "public_members_url": "https://api.github.com/orgs/nasqueron/public_members{/member}",
67 "avatar_url": "https://avatars.githubusercontent.com/u/5605546?v=4",
68 "description": "Central hub of a budding community of creative people, writers, developers and thinkers."
69 },
70 "sender": {
71 "login": "dereckson",
72 "id": 135563,
73 "node_id": "MDQ6VXNlcjEzNTU2Mw==",
74 "avatar_url": "https://avatars.githubusercontent.com/u/135563?v=4",
75 "gravatar_id": "",
76 "url": "https://api.github.com/users/dereckson",
77 "html_url": "https://github.com/dereckson",
78 "followers_url": "https://api.github.com/users/dereckson/followers",
79 "following_url": "https://api.github.com/users/dereckson/following{/other_user}",
80 "gists_url": "https://api.github.com/users/dereckson/gists{/gist_id}",
81 "starred_url": "https://api.github.com/users/dereckson/starred{/owner}{/repo}",
82 "subscriptions_url": "https://api.github.com/users/dereckson/subscriptions",
83 "organizations_url": "https://api.github.com/users/dereckson/orgs",
84 "repos_url": "https://api.github.com/users/dereckson/repos",
85 "events_url": "https://api.github.com/users/dereckson/events{/privacy}",
86 "received_events_url": "https://api.github.com/users/dereckson/received_events",
87 "type": "User",
88 "site_admin": false
89 }
90}

Exception:

As the event doesn't contain a repository, it triggers an error.

[2024-10-08 18:59:49] production.ERROR: ErrorException: Undefined property: stdClass::$repository in /var/wwwroot/default/app/Analyzers/GitHub/GitHubPayloadAnalyzer.php:84
Stack trace:
#0 /var/wwwroot/default/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(266): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Undefined prope...', '/var/wwwroot/d
e...', 84)
#1 /var/wwwroot/default/app/Analyzers/GitHub/GitHubPayloadAnalyzer.php(84): Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}(2, 'Undefined prope...', '/var/wwwroot/de...',
 84)
#2 /var/wwwroot/default/app/Analyzers/BasePayloadAnalyzer.php(164): Nasqueron\Notifications\Analyzers\GitHub\GitHubPayloadAnalyzer->getItemName()
#3 /var/wwwroot/default/app/Notifications/GitHubNotification.php(51): Nasqueron\Notifications\Analyzers\BasePayloadAnalyzer->getGroup()
#4 /var/wwwroot/default/app/Notifications/GitHubNotification.php(26): Nasqueron\Notifications\Notifications\GitHubNotification->getGroup()
#5 /var/wwwroot/default/app/Jobs/FireGitHubNotification.php(41): Nasqueron\Notifications\Notifications\GitHubNotification->__construct('Nasqueron', 'organization', Object(stdClass))

Event Timeline

dereckson triaged this task as Normal priority.Oct 8 2024, 22:23
dereckson created this task.

The same issue is triggered by projects_v2, again because there is no repository.

This issue IS NOT triggered for ping and membership, as those are declared as administrative events.

A fix could be to add organization and projects_v2 in that list:
https://devcentral.nasqueron.org/source/notifications/browse/main/app/Analyzers/GitHub/GitHubPayloadAnalyzer.php$91