txpipe / oura

The tail of Cardano
https://txpipe.github.io/oura
Apache License 2.0
257 stars 71 forks source link

Crashing due to GCP Pub/Sub API token expiration #488

Open Vardominator opened 1 year ago

Vardominator commented 1 year ago

When using the GCP Pub/Sub sink, Oura is crashing due to an access token expiration:

thread '<unnamed>' panicked at 'writer loop failed: PubSub { code: 401, message: "{\n  \"error\": {\n    \"code\": 401,\n    \"message\": \"Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.\",\n    \"status\": \"UNAUTHENTICATED\",\n    \"details\": [\n      {\n        \"@type\": \"type.googleapis.com/google.rpc.ErrorInfo\",\n        \"reason\": \"ACCESS_TOKEN_EXPIRED\",\n        \"domain\": \"googleapis.com\",\n        \"metadata\": {\n          \"method\": \"google.pubsub.v1.Publisher.Publish\",\n          \"service\": \"pubsub.googleapis.com\"\n        }\n      }\n    ]\n  }\n}\n", status: "Error occurred attempting to subscribe" }', src/sinks/gcp_pubsub/setup.rs:44:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Is it possible to automatically refresh the access token without having to restart Oura?

scarmuega commented 1 year ago

@Vardominator FYI, latest version of the google pubsub lib seems to have implemented automatic token refresh. The lib has some breaking change, I'll work on applying them on Oura's side.