Starting on Jan 26, 2026, our Google Managed Prometheus (GMP) datasource in Grafana Cloud began experiencing intermittent 401 Unauthorized errors with the message ACCESS_TOKEN_EXPIRED.
We use the standard gmp-datasource-syncer (v0.17.3) running as a Cloud Run Job to rotate OAuth2 tokens every 10 minutes. Despite the job succeeding and the Grafana API acknowledging the update (incrementing the datasource version), queries fail with a 401 approximately 20 minutes after a fresh token is pushed, even though GCP access tokens have a default 60-minute TTL.
Steps to Reproduce
Attempted Fixes:
- Manual Header Reset: Manually deleted the Authorization header in the Grafana UI and allowed the Cloud Run job to recreate it. This resolved the issue for ~20 minutes before it recurred.
- Job Health Verification: Confirmed the gmp-datasource-syncer job is completing successfully (EXECUTION_SUCCEEDED) and that the Grafana API returns 200 OK for the update.
- IAM Verification: Verified that the Google Service Account (GSA) used by the syncer has
roles/monitoring.viewer permissions and that no IAM changes occurred recently.
- Token Lifetime Check: Observed that tokens appear to "expire" in the Grafana proxy's view in ~20 minutes, suggesting a potential caching or token-shadowing issue in the Grafana Cloud backend.
- Please note that the same issue is reproducible with an older image (
v0.14.0-gke.0)
Environment Information
- Grafana Version: 12.4.0 (Cloud)
- Syncer Image: gke.gcr.io/prometheus-engine/datasource-syncer:v0.17.3-gke.0
- Infrastructure: Google Cloud Run (Job triggered by Cloud Scheduler)
apiVersion: run.googleapis.com/v1
kind: Job
metadata:
name: gmp-datasource-syncer-prd
labels:
component: gmp-datasource-syncer
spec:
template:
spec:
template:
spec:
containers:
- name: gmp-datasource-syncer
image: gke.gcr.io/prometheus-engine/datasource-syncer:v0.17.3-gke.0
args:
- --datasource-uids=REDACTED_UID
- --grafana-api-endpoint=https://REDACTED.grafana.net
- --project-id=REDACTED-PROJECT-ID
env:
- name: GRAFANA_SERVICE_ACCOUNT_TOKEN
valueFrom:
secretKeyRef:
key: latest
name: grafana-sa-token
serviceAccountName: gmp-syncer-sa@REDACTED.iam.gserviceaccount.com
Starting on Jan 26, 2026, our Google Managed Prometheus (GMP) datasource in Grafana Cloud began experiencing intermittent 401 Unauthorized errors with the message
ACCESS_TOKEN_EXPIRED.We use the standard gmp-datasource-syncer (v0.17.3) running as a Cloud Run Job to rotate OAuth2 tokens every 10 minutes. Despite the job succeeding and the Grafana API acknowledging the update (incrementing the datasource version), queries fail with a 401 approximately 20 minutes after a fresh token is pushed, even though GCP access tokens have a default 60-minute TTL.
Steps to Reproduce
Attempted Fixes:
roles/monitoring.viewerpermissions and that no IAM changes occurred recently.v0.14.0-gke.0)Environment Information