AuditEvents::BuildService::MissingAttributeError: AuditEvents::BuildService::MissingAttributeError

https://sentry.gitlab.net/gitlab/gitlabcom/issues/4108852/?referrer=gitlab_plugin

AuditEvents::BuildService::MissingAttributeError: AuditEvents::BuildService::MissingAttributeError
  app/services/audit_events/build_service.rb:14:in `initialize'
    raise MissingAttributeError if missing_attribute?(author, scope, target, message)
  lib/gitlab/audit/auditor.rb:169:in `new'
    AuditEvents::BuildService.new(
  lib/gitlab/audit/auditor.rb:169:in `build_event'
    AuditEvents::BuildService.new(
  lib/gitlab/audit/auditor.rb:89:in `single_audit'
    events = [build_event(@message)]
  lib/gitlab/audit/auditor.rb:58:in `audit'
    auditor.single_audit
...
(107 additional frame(s) were not displayed)

AuditEvents::BuildService::MissingAttributeError

Verification steps:

  1. Amend policy last commit author email for a policy configuration repository with an email not available in GitLab.
  2. Invoke ProcessScanResultPolicyWorker by removing and adding back a protected branch to policy attached project repository.
  3. In the Sidekiq logs for the worker, we should not see the error.
Edited by Bala Kumar