以下のコードは、Google の nodejs クライアント バージョンを使用して、Google Analytics Reporting API を呼び出し0.7
ます。socket hang up
一部の実行でエラーが返されますが、常にではありません。これは Google のサーバー側のエラーでしょうか? デバッグする簡単な方法はありますか? ところで、レート制限が原因かどうかはわかりませんが、連続して複数の呼び出しを行っています。
gapi = require "googleapis"
authClient = new gapi.auth.JWT(
config.ga.clientEmail,
config.ga.privateKeyPath,
null,
[config.ga.scopeUri]
)
authPromise = new Promise (resolve, reject) ->
authClient.authorize (err, token) ->
resolve token
return
return
authPromise.then ->
gapi.discover('analytics', 'v3')
.withAuthClient(authClient)
.execute (err, client) ->
...