Skip to content

Enhance GCP service account creation logging - #511

Merged
bokelley merged 2 commits into
mainfrom
bokelley/fix-service-account-bugs
Oct 19, 2025
Merged

Enhance GCP service account creation logging#511
bokelley merged 2 commits into
mainfrom
bokelley/fix-service-account-bugs

Conversation

@bokelley

Copy link
Copy Markdown
Collaborator

Background

The "404 Service account ... does not exist" error indicates potential issues with service account creation, propagation, or verification. Enhanced logging and verification are needed to pinpoint the root cause.

Changes

  • src/services/gcp_service_account_service.py:
    • Added detailed logging before and after GCP API calls for _create_service_account and _create_service_account_key.
    • Implemented _verify_service_account_exists to check if a service account exists in GCP post-creation. This is now called after creation with a warning if it fails to avoid blocking on transient issues.
    • Wrapped GCP API calls in try-catch blocks with more comprehensive error context.
    • Added a test_connection method to verify IAM API connectivity and permissions (e.g., ability to list service accounts).
    • Added logging for account_id, display_name, and tenant_id during creation.

Testing

  • Attempt to create a service account for a tenant.
  • Review logs for detailed steps of creation and verification.
  • Verify that _verify_service_account_exists is called and its output is logged.
  • Manually check the GCP console to confirm if the service account was created when logs indicate success.
  • Test the test_connection method.

- Add comprehensive logging throughout service account creation flow
- Add verification step after creating service account to catch propagation issues
- Improve error messages with full context (account_id, project, resource names)
- Add try-catch blocks in key creation methods for better error handling

This helps diagnose issues like the 'service account does not exist' error
by logging each step and verifying the account exists before creating keys.
Add test_connection() method to verify GCP IAM API connectivity and
permissions. This helps diagnose configuration issues before attempting
to create service accounts.
@bokelley
bokelley merged commit 65b2df7 into main Oct 19, 2025
8 checks passed
EmmaLouise2018 pushed a commit that referenced this pull request Oct 24, 2025
* Add detailed logging and service account verification

- Add comprehensive logging throughout service account creation flow
- Add verification step after creating service account to catch propagation issues
- Improve error messages with full context (account_id, project, resource names)
- Add try-catch blocks in key creation methods for better error handling

This helps diagnose issues like the 'service account does not exist' error
by logging each step and verifying the account exists before creating keys.

* Add connection test method for GCP service account service

Add test_connection() method to verify GCP IAM API connectivity and
permissions. This helps diagnose configuration issues before attempting
to create service accounts.
danf-newton pushed a commit to Newton-Research-Inc/salesagent that referenced this pull request Nov 24, 2025
* Add detailed logging and service account verification

- Add comprehensive logging throughout service account creation flow
- Add verification step after creating service account to catch propagation issues
- Improve error messages with full context (account_id, project, resource names)
- Add try-catch blocks in key creation methods for better error handling

This helps diagnose issues like the 'service account does not exist' error
by logging each step and verifying the account exists before creating keys.

* Add connection test method for GCP service account service

Add test_connection() method to verify GCP IAM API connectivity and
permissions. This helps diagnose configuration issues before attempting
to create service accounts.
bokelley referenced this pull request in bokelley/salesagent May 5, 2026
* Add detailed logging and service account verification

- Add comprehensive logging throughout service account creation flow
- Add verification step after creating service account to catch propagation issues
- Improve error messages with full context (account_id, project, resource names)
- Add try-catch blocks in key creation methods for better error handling

This helps diagnose issues like the 'service account does not exist' error
by logging each step and verifying the account exists before creating keys.

* Add connection test method for GCP service account service

Add test_connection() method to verify GCP IAM API connectivity and
permissions. This helps diagnose configuration issues before attempting
to create service accounts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant