Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: test webhook NPE (#7400)

Danny Xuf2a86c5a0970
diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.go
index 1303686450..71c5bbcdb5 100644
--- a/backend/api/v1/project_service.go
+++ b/backend/api/v1/project_service.go
@@ -1529,6 +1529,7 @@ func (s *ProjectService) TestWebhook(ctx context.Context, request *v1pb.TestWebh
return nil, status.Errorf(codes.NotFound, "webhook %q not found", request.Webhook.Url)
}
+ resp := &v1pb.TestWebhookResponse{}
err = webhookPlugin.Post(
webhook.Type,
webhookPlugin.Context{
@@ -1545,8 +1546,11 @@ func (s *ProjectService) TestWebhook(ctx context.Context, request *v1pb.TestWebh
Project: &webhookPlugin.Project{Name: project.Title},
},
)
+ if err != nil {
+ resp.Error = err.Error()
+ }
- return &v1pb.TestWebhookResponse{Error: err.Error()}, nil
+ return resp, nil
}
// CreateDatabaseGroup creates a database group.