Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Fix error handling for bitbucker server when user does not match #51024

@kopancek

Description

@kopancek

We recently had a customer who was receiving a lot of log error messages like:

{"log":"{\"SeverityText\":\"ERROR\",\"Timestamp\":1681934880664948436,\"InstrumentationScope\":\"repo-updater.PermsSyncer.fetchUserPermsViaExternalAccounts\",\"Caller\":\"authz/perms_syncer.go:352\",\"Function\":\"github.com/sourcegraph/sourcegraph/enterprise/cmd/repo-updater/internal/authz.(*PermsSyncer).fetchUserPermsViaExternalAccounts\",\"Body\":\"could not fetch account from authz provider\",\"Resource\":{\"service.name\":\"repo-updater\",\"service.version\":\"5.0.1\",\"service.instance.id\":\"repo-updater-56f745595c-jgcjb\"},\"Attributes\":{\"userID\":11,\"authzProvider\":\"https://bitbucket.cicd.dc/\",\"error\":\"no results returned by the Bitbucket Server API\"}}

The problem is caused by incorrectly handling response from bitbucket server as error here; which is used here.

That implementation is incorrect, as it should not return an error when no user is found. That can happen in a lot of cases, e.g. when the user does not have a bitbucket server account linked.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions