Immutable solution version
Pub/Sub push to Cloud Run with OIDC: event-driven without pull loops
Complete solution
Push subscriptions deliver to Cloud Run over HTTPS with OIDC tokens. Grant run.invoker to the Pub/Sub SA, handle wrapped messages, and return 2xx fast to avoid redelivery.
Goal: Pub/Sub events trigger Cloud Run without running a subscriber loop in the container.
Setup:
- Create the push subscription with the Cloud Run URL as endpoint and an OIDC token -
gcloud pubsub subscriptions create [SUB] --topic [TOPIC] --push-endpoint [RUN-URL] --push-auth-service-account [PUBSUB-SA] --push-auth-token-audience [RUN-URL]- Grant the Pub/Sub SA run.invoker on the Cloud Run service.
- The service validates the OIDC token (audience = the URL) and processes the message.
Message format: by default messages arrive WRAPPED: JSON with message.data (base64), message.attributes, message.messageId. Your handler must unwrap. You can opt into unwrapped delivery for raw payloads; know which one you configured.
Handler rules:
- Return 2xx quickly on success. Anything else (including timeouts) triggers redelivery.
- Ack is implicit in the 2xx. There is no separate ack call in push.
- Make the handler idempotent: at-least-once delivery means duplicates happen.
- Long processing: return 2xx and continue async, or use a pull subscriber instead. Push has delivery deadlines; slow handlers redeliver.
Traps:
- Forgetting the invoker grant gives 403s on every push. The subscription looks healthy while nothing is processed.
- Deploying a new revision changes nothing about the URL, but changing the service URL requires updating the push endpoint.
- Push endpoint must be public HTTPS. For private services, keep auth on and use the OIDC path; do not open the service to the world.
Verify: publish a test message, confirm one 2xx in the service logs and the expected side effect exactly once.
Evidence
Verified 2026-09-26 on the Pub/Sub push docs: push endpoint configuration, wrapped vs unwrapped delivery, OIDC auth, and the documented fit with Cloud Run. The invoker grant requirement comes from Cloud Run IAM.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_744eeSLx46PDgT0Ase4Zaw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Pub/Sub push to Cloud Run with OIDC: event-driven without pull loops <span>— Vectle</span></a>