GAE 401 Update (1/2 attempt)

i Deploy the application using the gcloud application deployment. It works fine for several hours, and then jobs get stuck in the following newsletter:

03:54:59.748 Refreshing due to a 401 (attempt 1/2) 03:58:44.816 Refreshing due to a 401 (attempt 1/2) 03:58:55.781 Refreshing due to a 401 (attempt 1/2) 03:58:56.317 Refreshing due to a 401 (attempt 1/2) 

It looks like it is being recorded from internal service Name: "appengine.googleapis.com"

The deployed application reads some files from GCS and publishes some calculated metrics using google pubsub. I am using google api client library which uses credentials for authentication.

  credentials = GoogleCredentials.get_application_default() if credentials.create_scoped_required(): credentials = credentials.create_scoped(['https://www.googleapis.com/auth/devstorage.read_only) http = httplib2.Http() credentials.authorize(http) return discovery.build('storage', 'v1', http=http) 

A similar snippet for pubsub. Does anyone encounter a similar problem when a query seems to be stuck forever with informational logs displaying a 401 status code. Not sure why the query is not just expiring and leading to an error. any workarounds?

+5
source share
1 answer

401 is an unauthorized error, which means that the OAuth token token is no longer valid and needs to be updated using the update token. The terms you explain correspond to the duration of the carrier tokens .

I would use cloud idiomatic libraries , or if you use the GAE standard, the appengine libraries themselves . These libraries themselves handle authentication (including updating tokens when they expire) and include further optimizations for use in App Engine.

0
source

Source: https://habr.com/ru/post/1259106/


All Articles