Search code examples
google-app-enginegoogle-drive-apigoogle-app-engine-pythongoogle-cloud-stackdriver

How do you retrieve a google drive watcher channel id?


I want to stop a channel with that method: https://developers.google.com/drive/v3/reference/channels/stop

My issue is that I can't remember the uuid that I need to pass to stop the watcher.

I should be able to retrieve that info from the header X-GOOG-CHANNEL-ID google sends to the webhook adress I registered when I created the watcher.

But second issue is that webhook callback for the watcher is on a google standard engine.

There are stackdriver logs, I see the webhook adress getting hit, but I'm unable in those logs to see the headers sent.

There are no methods on the drive API to get a list of 'alive' watchers, so I guess my only option is to somehow log in the standard engine instance the headers of the POST request sent to the webhook adress.

From the stackdriver doc, requests header should be in the httpRequest object, but mine mentions only that for the webhook adress route declared earlier.

httpRequest: { status: 500
}

Any idea ?


Solution

  • I found a solution, once has to use the debug facility at https://console.cloud.google.com/debug?dlv=4&project=YOURPROJECT&app=GAE:SERVICE@VERSION

    You put a breakpoint called a Snapshot in the webhook adress route at the beginning with a code like this one for instance: watcherid = request.headers['X-GOOG-CHANNEL-ID'] and thus will be able to inspect variables and the watcherid variable.