This repository was archived by the owner on Jun 2, 2025. It is now read-only.
This repository was archived by the owner on Jun 2, 2025. It is now read-only.
Open
Description
$ timeliner -config ../timeliner.toml reauth google_photos/me@gmail.com; uptime; timeliner -config ../timeliner.toml get-latest google_photos/me@gmail.com; uptime
23:13 up 1 day, 6:53, 7 users, load averages: 1.31 1.91 2.14
2022/01/05 00:13:13 [ERROR] google_photos/me@gmail.com: doing API request: >>> Post "https://photoslibrary.googleapis.com/v1/mediaItems:search": oauth2: token expired and refresh token is not set <<< - retr
ying... (attempt 1/10)
2022/01/05 00:13:23 [ERROR] google_photos/me@gmail.com: doing API request: >>> Post "https://photoslibrary.googleapis.com/v1/mediaItems:search": oauth2: token expired and refresh token is not set <<< - retr
ying... (attempt 2/10)
2022/01/05 00:13:33 [ERROR] google_photos/me@gmail.com: doing API request: >>> Post "https://photoslibrary.googleapis.com/v1/mediaItems:search": oauth2:
6DC4
token expired and refresh token is not set <<< - retr
ying... (attempt 3/10)
2022/01/05 00:13:43 [ERROR] google_photos/me@gmail.com: doing API request: >>> Post "https://photoslibrary.googleapis.com/v1/mediaItems:search": oauth2: token expired and refresh token is not set <<< - retr
ying... (attempt 4/10)
2022/01/05 00:13:53 [ERROR] google_photos/me@gmail.com: doing API request: >>> Post "https://photoslibrary.googleapis.com/v1/mediaItems:search": oauth2: token expired and refresh token is not set <<< - retr
ying... (attempt 5/10)
2022/01/05 00:14:03 [ERROR] google_photos/me@gmail.com: doing API request: >>> Post "https://photoslibrary.googleapis.com/v1/mediaItems:search": oauth2: token expired and refresh token is not set <<< - retr
ying... (attempt 6/10)
2022/01/05 00:14:13 [ERROR] google_photos/me@gmail.com: doing API request: >>> Post "https://photoslibrary.googleapis.com/v1/mediaItems:search": oauth2: token expired and refresh token is not set <<< - retr
ying... (attempt 7/10)
2022/01/05 00:14:23 [ERROR] google_photos/me@gmail.com: doing API request: >>> Post "https://photoslibrary.googleapis.com/v1/mediaItems:search": oauth2: token expired and refresh token is not set <<< - retr
ying... (attempt 8/10)
2022/01/05 00:14:33 [ERROR] google_photos/me@gmail.com: doing API request: >>> Post "https://photoslibrary.googleapis.com/v1/mediaItems:search": oauth2: token expired and refresh token is not set <<< - retr
ying... (attempt 9/10)
2022/01/05 00:14:43 [ERROR] google_photos/me@gmail.com: doing API request: >>> Post "https://photoslibrary.googleapis.com/v1/mediaItems:search": oauth2: token expired and refresh token is not set <<< - retr
ying... (attempt 10/10)
2022/01/05 00:14:53 [ERROR] google_photos/me@gmail.com: a listing goroutine errored: getting items on next page: requesting next page: Post "https://photoslibrary.googleapis.com/v1/mediaItems:search": oauth
2: token expired and refresh token is not set
2022/01/05 00:14:53 [ERROR][google_photos/me@gmail.com] Getting latest: getting items from service: one or more errors: getting items on next page: requesting next page: Post "https://photoslibrary.googleap
is.com/v1/mediaItems:search": oauth2: token expired and refresh token is not set
0:14 up 1 day, 7:55, 7 users, load averages: 0.68 1.14 1.23
I tried to add some reauth hack when this failure happens, but that didn't work:
diff --git a/datasources/googlephotos/googlephotos.go b/datasources/googlephotos/googlephotos.go
index c14494a..3e5f71c 100644
--- a/datasources/googlephotos/googlephotos.go
+++ b/datasources/googlephotos/googlephotos.go
@@ -314,6 +314,21 @@ func (c *Client) apiRequestWithRetry(method, endpoint string, reqBodyData, respI
if err != nil {
log.Printf("[ERROR] %s/%s: doing API request: >>> %v <<< - retrying... (attempt %d/%d)",
DataSourceID, c.userID, err, i+1, maxTries)
+ if strings.Contains(err.Error(), "token expired and refresh token is not set") {
+ log.Printf("HACK: reauth that puppy")
+ // open the timeline
+ tl, err := timeliner.Open("./timeliner_repo")
+ if err != nil {
+ log.Fatalf("[FATAL] Opening timeline: %v", err)
+ }
+ defer tl.Close()
+ // reauth
+ err2 := tl.Authenticate(DataSourceID, c.userID)
+ if err2 != nil {
+ log.Fatalf("[FATAL] Authenticating: %v", err2)
+ }
+
+ }
time.Sleep(10 * time.Second)
continue
}
Probably another timerliner.Open
isn't right here, but I didn't figure out how to pass down the handle from main.go
due to my lack of Go knowledge 🙂
Any insight would be appreciated, also if it happens for other people.
Metadata
Metadata
Assignees
Labels
No labels