Fix: Correct AdManagerClient signature for service account auth #571
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
PR #570 was merged but inventory sync still fails for service account authentication with error:
Affected tenant:
weatherat https://sales-agent.scope3.com/admin/tenant/weather/inventory?type=allRoot Cause
The
AdManagerClientconstructor has different signatures depending on credential type:OAuth credentials (
googleads.oauth2.GoogleRefreshTokenClient):CreateHttpHeadermethodAdManagerClient(oauth_client, "App Name", network_code=...)Service account credentials (
google.oauth2.service_account.Credentials):CreateHttpHeadermethod (it's from google-auth, not googleads)AdManagerClient(credentials, network_code)(2 args only)Solution
Changed service account AdManagerClient initialization from 3 args to 2 args (line 576):
OAuth path remains unchanged (line 596) - correctly uses 3 arguments.
Evidence
GAM health check (
src/adapters/gam/utils/health_check.py:86) uses the same 2-argument pattern:Testing
Impact
Fixes #570