diff --git a/src/sentry/lang/native/sources.py b/src/sentry/lang/native/sources.py index 29339e3c69aef6..ea470f0c4f1548 100644 --- a/src/sentry/lang/native/sources.py +++ b/src/sentry/lang/native/sources.py @@ -584,7 +584,7 @@ def fetch_token_for_gcp_source(source, organization): # if target_credentials.token is None it means that the # token could not be fetched successfully if token is not None: - source["bearer_token"] = token + source["bearer_token"] = "Bearer " + token # Remove other credentials if we have a token if "client_email" in source: diff --git a/tests/sentry/lang/native/test_sources.py b/tests/sentry/lang/native/test_sources.py index ec2d36097baca4..3e52c098da57a1 100644 --- a/tests/sentry/lang/native/test_sources.py +++ b/tests/sentry/lang/native/test_sources.py @@ -57,7 +57,7 @@ def test_sources_gcp_bearer_authentication(self, mock_get_gcp_token, default_pro for i in (1, 2): assert "client_email" not in sources[i] assert "private_key" not in sources[i] - assert sources[i]["bearer_token"] == "ya29.TOKEN" + assert sources[i]["bearer_token"] == "Bearer ya29.TOKEN" @override_settings(SENTRY_BUILTIN_SOURCES=SENTRY_BUILTIN_SOURCES_TEST) @patch("sentry.lang.native.sources.get_gcp_token") @@ -84,7 +84,7 @@ def test_source_alias(self, mock_get_gcp_token, default_project): for i in (1, 2): assert "client_email" not in sources[i] assert "private_key" not in sources[i] - assert sources[i]["bearer_token"] == "ya29.TOKEN" + assert sources[i]["bearer_token"] == "Bearer ya29.TOKEN" class TestIgnoredSourcesFiltering: