fix: remove Sentry error logging for streaming configurations

Changes

  • Add proper error handling in GraphQL mutations to prevent validation errors from being logged to Sentry
  • Handle ActiveRecord::RecordInvalid exceptions for streaming audit event destination validation failures
  • Convert validation errors to user-friendly GraphQL errors instead of logging to Sentry

Audit-events-·-GitLab-Duo-·-GitLab-08-22-2025_02_02_PM.png

Validation

Prerequisites

  • You need Owner permissions on a group to test group-level destinations
  • You need Admin permissions on the instance to test instance-level destinations

1. Test Group External Audit Event Destinations

Navigate to Group Settings:

  1. Go to your group -> Secure -> Audit Events -> Streams
  2. Click "Add streaming destination"

Test Scenario 1 - Name Too Long:

  1. Fill in the form:
    • Destination URL: https://example.com/webhook
    • Name: Enter exactly 73 characters (e.g., aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
  2. Click "Add destination"
  3. Expected Result: You should see a user-friendly error message instead of a generic server error
  4. Verify: No new Sentry errors are logged for this validation failure

Test Scenario 2 - Limit Exceeded:

  1. First, create 5 streaming destinations (if the limit is 5)
  2. Try to create a 6th destination
  3. Expected Result: You should see an error message about exceeding the maximum limit
  4. Verify: No Sentry errors are logged

2. Test Instance External Audit Event Destinations

Navigate to Admin Settings:

  1. Go to Admin Area -> Monitoring ->Audit Events -> Streams
  2. Click "Add streaming destination"

Test the same scenarios as above:

  • Name too long (73+ characters)
  • Limit exceeded (create 5, then try a 6th)

3. Verification Steps

Before this fix:

  • Validation errors would show as generic "Something went wrong" messages
  • Internal server errors (500) would be returned
  • Sentry would log these as exceptions

After this fix:

  • Clear, specific error messages are displayed
  • Proper GraphQL validation errors (not 500s)
  • No Sentry logging for expected validation failures

4. Browser Developer Tools Check

  1. Open browser Developer Tools (F12)
  2. Go to Network tab
  3. Perform the test scenarios above
  4. Check the GraphQL responses:
    • Should return proper error messages in the response
    • HTTP status should be 200 (not 500)
    • Error messages should be user-friendly

Relates to issue #558411 (closed)

Edited by Nate Rosandich

Merge request reports

Loading