diff --git a/internal/services/gateway/webhook.go b/internal/services/gateway/webhook.go index f1e1db4..6c997c6 100644 --- a/internal/services/gateway/webhook.go +++ b/internal/services/gateway/webhook.go @@ -174,6 +174,13 @@ func (h *webhooksHandler) handleWebhook(r *http.Request) (int, string, error) { if err != nil { return http.StatusBadRequest, "", errors.Wrapf(err, "failed to parse webhook") } + // skip nil webhook data + // TODO(sgotti) report the reason of the skip + if webhookData == nil { + h.log.Infof("skipping webhook") + return 0, "", nil + } + webhookData.ProjectID = projectID // get project variables @@ -223,6 +230,12 @@ func (h *webhooksHandler) handleWebhook(r *http.Request) (int, string, error) { if err != nil { return http.StatusBadRequest, "", errors.Wrapf(err, "failed to parse webhook") } + // skip nil webhook data + // TODO(sgotti) report the reason of the skip + if webhookData == nil { + h.log.Infof("skipping webhook") + return 0, "", nil + } user, _, err := h.configstoreClient.GetUser(ctx, userID) if err != nil {