diff --git a/api/pkg/webhooks/errors.go b/api/pkg/webhooks/errors.go index f8287f0c..edf9ec35 100644 --- a/api/pkg/webhooks/errors.go +++ b/api/pkg/webhooks/errors.go @@ -1,16 +1,25 @@ package webhooks -import "fmt" +import ( + "fmt" + + "github.com/google/uuid" +) type WebhookError struct { - msg string - err error + msg string + err error + ReferenceID string } +// NewWebhookError wraps a failed webhook call. Each error gets its own reference id, which is part of +// the message, so a user can quote it and the platform owner can find the matching log line. func NewWebhookError(err error) *WebhookError { + referenceID := uuid.New().String() return &WebhookError{ - msg: "error invoking webhook", - err: err, + msg: fmt.Sprintf("error invoking webhook. Please contact the platform owner (reference id: %s)", referenceID), + err: err, + ReferenceID: referenceID, } } diff --git a/api/service/projects_service.go b/api/service/projects_service.go index df8fc586..5e1d7701 100644 --- a/api/service/projects_service.go +++ b/api/service/projects_service.go @@ -171,7 +171,7 @@ func (service *projectsService) UpdateProject(ctx context.Context, project *mode return nil }, func(err error) error { // Print error and return - log.Errorf("error calling webhook - %s, err: %s", ProjectCreatedEvent, err.Error()) + log.Errorf("error calling webhook - %s, err: %s", ProjectUpdatedEvent, err.Error()) return err }, ) diff --git a/go.mod b/go.mod index e6da7445..f4b57f78 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,7 @@ require ( github.com/go-playground/validator/v10 v10.11.1 github.com/golang-migrate/migrate/v4 v4.11.0 github.com/google/go-cmp v0.5.9 + github.com/google/uuid v1.3.0 github.com/gorilla/mux v1.7.4 github.com/hashicorp/vault/api v1.9.0 github.com/hashicorp/vault/api/auth/gcp v0.4.0 @@ -87,7 +88,6 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.1.0 // indirect - github.com/google/uuid v1.3.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.1 // indirect github.com/googleapis/gax-go/v2 v2.7.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect diff --git a/ui/packages/app/src/project_setting/project_info/UpdateProjectInfoModal.js b/ui/packages/app/src/project_setting/project_info/UpdateProjectInfoModal.js index 32521819..85a83f6e 100644 --- a/ui/packages/app/src/project_setting/project_info/UpdateProjectInfoModal.js +++ b/ui/packages/app/src/project_setting/project_info/UpdateProjectInfoModal.js @@ -75,11 +75,11 @@ const UpdateProjectInfoModal = ({ } ]; - const rows = project.labels.map(label => ({ + const rows = (project.labels || []).map(label => ({ ...label })); - const originalRows = originalProject.labels.map(label => ({ + const originalRows = (originalProject.labels || []).map(label => ({ ...label }));