Skip to content

nil pointer exception when uninstalled repo webhook is fired #2059

@motatoes

Description

@motatoes

If an app installation fails or does not redirect to callback then github does not have a reflection of records for github app installation link or a repo records. This leads to a nil pointer exception

Excepted behaviour: digger should gracefully fail and comment with a message saying that there was no record found for the installation and asking the user to double check that the app was installed successfully and lead to the callback

time=2025-07-29T15:29:39.955Z level=INFO msg="Query OK" db.duration=4.264368ms db.rows=0 db.file=storage.go:564 db.query="SELECT * FROM \"github_app_installation_links\" WHERE (github_installation_id = 69477001 AND status=1) AND \"github_app_installation_links\".\"deleted_at\" IS NULL"
time=2025-07-29T15:29:39.955Z level=ERROR msg="Recovered from panic in handleIssueCommentEvent" error="runtime error: invalid memory address or nil pointer dereference"
Stack trace:
goroutine 148 [running]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:26 +0x5e
github.com/diggerhq/digger/backend/controllers.handleIssueCommentEvent.func1()
/go/src/github.com/diggerhq/digger/backend/controllers/github.go:1221 +0x3f
panic({0x26766e0?, 0x49e9e50?})
/usr/local/go/src/runtime/panic.go:787 +0x132
github.com/diggerhq/digger/backend/controllers.handleIssueCommentEvent({0x3243a00, 0x4c5a560}, 0xc000d0e4c0, {0x3214200, 0x4c5a560}, 0x14c054, {0x4c5a560, 0x0, 0x0?})
/go/src/github.com/diggerhq/digger/backend/controllers/github.go:1271 +0x6fe
created by github.com/diggerhq/digger/backend/controllers.DiggerController.GithubAppWebHook in goroutine 146
/go/src/github.com/diggerhq/digger/backend/controllers/github.go:124 +0xbe5
time=2025-07-29T15:29:48.050Z level=INFO msg="Incoming request" http.request.time=2025-07-29T15:29:48.050Z http.request.method=GET http.request.host=10.0.2.67:3000 http.request.path=/health http.request.query="" http.request.params=map[] http.request.route=/health http.request.ip=10.0.3.112 http.request.referer="" http.request.length=0 http.response.time=2025-07-29T15:29:48.050Z http.response.latency=59.792µs http.response.status=200 http.response.length=93 http.id=580d4e2d-cce5-4b6f-88e6-9908b6e4c630
[GIN] 2025/07/29 - 15:29:48 | 200 | 136.242µs | 10.0.3.112 | GET "/health"
time=2025-07-29T15:30:08.050Z level=INFO msg="Incoming request" http.request.time=2025-07-29T15:30:08.050Z http.request.method=GET http.request.host=10.0.2.67:3000 http.request.path=/health http.request.query="" http.request.params=map[] http.request.route=/health http.request.ip=10.0.3.112 http.request.referer="" http.request.length=0 http.response.time=2025-07-29T15:30:08.050Z http.response.latency=69.28µs http.response.status=200 http.response.length=93 http.id=c27fbf23-0902-4e00-b15d-5bce7a6b80fc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions