GAS エラー「GoogleJsonResponseException: API call to people.people.getBatchGet failed with error: Quota exceeded for quota metric ‘Critical read requests (Contact and Profile Reads)’ and limit ‘Critical read requests (Contact and Profile Reads) per minute per user’ of service ‘people.googleapis.com’ for consumer ‘project_number:502114720403’.」が発生した場合の対処法
- 作成日 2023.12.20
- Google Apps Script
GAS(Google Apps Script)で、エラー「GoogleJsonResponseException: API call to people.people.getBatchGet failed with error: Quota exceeded for quota metric ‘Critical read requests (Contact and Profile Reads)’ and limit ‘Critical read requests (Contact and Profile Reads) per minute per user’ of service ‘people.googleapis.com’ for consumer ‘project_number:502114720403’.」が発生した場合の対処法を記述してます。
環境
- OS windows11 home
- ブラウザ chrome 120.0.6099.71
エラー全文
以下のJSON形式のデータをchatに通知を送るプログラムで発生
results.forEach(result => {
postGoogleChat(result);
})
const postGoogleChat = (message) => {
let webhookUrl = "https://chat.googleapis.com/v1/spaces/xxxxx";
message = {
'text': message
};
let options = {
'payload': JSON.stringify(message),
'myamethod': 'POST',
'contentType': 'application/json'
};
let response = UrlFetchApp.fetch(webhookUrl, options);
}
エラーメッセージ
エラー
Exception: You do not have permission to call UrlFetchApp.fetch. Required permissions: https://www.googleapis.com/auth/script.external_request
原因
JSON形式のデータをchatに通知しようとしていたため
対処法
「JSON.stringify」などを使用する
postGoogleChat(JSON.stringify(result));
-
前の記事
kotlin setをMutableSetに変換する 2023.12.20
-
次の記事
java ファイルを作成する 2023.12.21
コメントを書く