TenantUpdatedEventListener Failure

Alert / Symptom

The listener logs log.error(…​) on any exception, which is picked up by Google Cloud Error Reporting and fires the standard error-reporting notification channel. The error group will contain the log line:

Failed to process tenant updated event [tenantId=<uuid>]

A secondary signal is a user ticket: "I renamed my company at Brønnøysundregistrene but Finsta still shows the old name." This indicates an event was consumed but not successfully processed.

The listener catches all exceptions, logs the error, and lets Pub/Sub ack the message. This means the event is consumed and will not be retried automatically — the error-reporting alert is the only automatic signal.

Impact

  • The tenant’s pendingBrregSync JSONB blob is never written to the organization row.

  • The user does not see the pending-sync indicator in the UI.

  • All other Finsta functionality is unaffected.

Diagnose

Check whether the listener is enabled:

# Verify the config property is not set to "false"
# TODO: replace <namespace> and <pod> with actual values for your environment
kubectl --context kind-conta-dev -n <namespace> exec <pod> -- env | grep conta.patron.tenant.updated.enabled

Check whether the Pub/Sub subscription exists:

# TODO: replace <project-id> with the GCP project ID
gcloud pubsub subscriptions describe tenantUpdated-finsta --project=<project-id>

Check recent error logs (GCP Cloud Logging):

resource.type="k8s_container"
jsonPayload.loggerName="tritt.finsta.service.tenant.TenantUpdatedEventListener"
severity>=ERROR

If the log line includes the full stack trace, read the exception to determine root cause (e.g. database connection failure, missing tenant schema, OrganizationService bug).

Mitigate

The user can trigger a manual sync from the Finsta UI:

  1. Open the financial statement for the affected tenant.

  2. Click the three-dot menu (⋮) on the Organization card.

  3. Select the sync / refresh option.

This calls OrganizationService directly and does not depend on Pub/Sub. See Organisasjons-synk for background on the sync flow.

Resolve

Depending on root cause:

Subscription missing

Recreate the tenantUpdated-finsta subscription in the correct GCP project, attached to the tenantUpdated topic.

Listener disabled

Verify conta.patron.tenant.updated.enabled is not set to false in the environment config (application-gcp.yml or Helm values). Restart the pod after correcting the value.

Transient error (DB, network)

The event is already acked and lost. Ask the user to trigger a manual sync (see Mitigate above), or replay the event from Patron if possible.

Escalate

If the root cause is unclear or the error persists across multiple tenants, escalate to the backend team. The owning code is TenantUpdatedEventListener in finsta-service-app (package tritt.finsta.service.tenant).