@@ -163,12 +163,12 @@ const webhookFormSchema = z.object({
|
||||
(val) => {
|
||||
try {
|
||||
const url = new URL(val);
|
||||
return url.protocol === "http:" || url.protocol === "https:";
|
||||
return url.protocol === "https:";
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
"URL must use http:// or https://",
|
||||
"URL must use https://",
|
||||
),
|
||||
selectedEvents: z
|
||||
.array(z.enum(WEBHOOK_EVENT_VALUES))
|
||||
|
||||
@@ -48,7 +48,7 @@ func (r *CreateWebhookConfigurationRequest) Validate() error {
|
||||
v := validator.New()
|
||||
|
||||
v.Check(r.OrganizationID, "organization_id", validator.Required(), validator.GID(coredata.OrganizationEntityType))
|
||||
v.Check(r.EndpointURL, "endpoint_url", validator.Required(), validator.URL())
|
||||
v.Check(r.EndpointURL, "endpoint_url", validator.Required(), validator.HTTPSUrl())
|
||||
|
||||
return v.Error()
|
||||
}
|
||||
@@ -57,7 +57,7 @@ func (r *UpdateWebhookConfigurationRequest) Validate() error {
|
||||
v := validator.New()
|
||||
|
||||
v.Check(r.WebhookConfigurationID, "webhook_configuration_id", validator.Required(), validator.GID(coredata.WebhookConfigurationEntityType))
|
||||
v.Check(r.EndpointURL, "endpoint_url", validator.NotEmpty(), validator.URL())
|
||||
v.Check(r.EndpointURL, "endpoint_url", validator.NotEmpty(), validator.HTTPSUrl())
|
||||
|
||||
return v.Error()
|
||||
}
|
||||
|
||||
@@ -323,7 +323,10 @@ func (s *Sender) recordEvent(
|
||||
}
|
||||
|
||||
err := s.pg.WithConn(ctx, func(conn pg.Conn) error {
|
||||
return event.Insert(ctx, conn, scope)
|
||||
if err := event.Insert(ctx, conn, scope); err != nil {
|
||||
return fmt.Errorf("cannot insert webhook event: %w", err)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
s.logger.ErrorCtx(ctx, "cannot insert webhook event",
|
||||
|
||||
Reference in New Issue
Block a user