Programing

할당량을 초과했기 때문에 요청을 완료할 수 없음

c10106 2022. 3. 14. 20:54
반응형

할당량을 초과했기 때문에 요청을 완료할 수 없음

javascript MediaUploader.js를 사용하여 유투브 비디오를 내 계정에 업로드하려고 했는데, 어떤 이유에서인지 onError 함수에서 다음과 같은 오류가 발생하였다.

"errors": [
   {
    "domain": "youtube.quota",
    "reason": "quotaExceeded",
    "message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e."
   }
  ],
  "code": 403,
  "message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e."

나는 오늘 몇 번 테스트했을 뿐인데, 이 이상한 실수를 했어.

var signinCallback = function (tokens, file){
console.log("signinCallback tokens: ",tokens);
if(tokens.accessToken) { //tokens.access_token
  console.log("signinCallback tokens.accessToken: ",tokens.accessToken);
  var metadata = {
    id: "101",
    snippet: {
      "title": "Test video upload",
      "description":"Description of uploaded video",
      "categoryId": "22",//22
      "tags": ["test tag1", "test tag2"],
    },
    status: {
        "privacyStatus": "private",
        "embeddable": true,
        "license": "youtube"
    }
    };
  console.log("signinCallback Object.keys(metadata).join(','): ",Object.keys(metadata).join(','));
  var options = {
    url: 'https://www.googleapis.com/upload/youtube/v3/videos?part=snippet%2Cstatus&key=<my api key>',

    file: file,
    token: tokens.accessToken,
    metadata: metadata,
    contentType: 'application/octet-stream',//"video/*",
    params: {
      part: Object.keys(metadata).join(',')
    },
    onError: function(data) {
      var message = data;
      // Assuming the error is raised by the YouTube API, data will be
      // a JSON string with error.message set. That may not be the
      // only time onError will be raised, though.
      try {
        console.log("signinCallback onError data: ",data);
        if(data!="Not Found"){
            var errorResponse = JSON.parse(data);
            message = errorResponse.error.message;
            console.log("signinCallback onError message: ",message);
            console.log("signinCallback onError errorResponse: ",errorResponse);
        }else{

        }
      } finally {
        console.log("signinCallback error.... ");
      }
    }.bind(this),
    onProgress: function(data) {
      var currentTime = Date.now();
      var bytesUploaded = data.loaded;
      var totalBytes = data.total;
      // The times are in millis, so we need to divide by 1000 to get seconds.
      var bytesPerSecond = bytesUploaded / ((currentTime - this.uploadStartTime) / 1000);
      var estimatedSecondsRemaining = (totalBytes - bytesUploaded) / bytesPerSecond;
      var percentageComplete = (bytesUploaded * 100) / totalBytes;
      console.log("signinCallback onProgress bytesUploaded, totalBytes: ",bytesUploaded, totalBytes);
      console.log("signinCallback onProgress percentageComplete: ",percentageComplete);
    }.bind(this),
    onComplete: function(data) {
      console.log("signinCallback onComplete data: ",data);
      var uploadResponse = JSON.parse(data);
      this.videoId = uploadResponse.id;
      //this.pollForVideoStatus();
    }.bind(this)
  }
  MediaUpload.videoUploader(options);
}

};

내 쿼터의 개발자 콘솔을 확인했는데, 내 쿼터 한도가 너무 커, 쿼터를 초과할 방법이 없어. ex, 오늘 총 89개의 쿼리가 있고, 나의 쿼터 한계는 하루에 10,000개야.

예상: 유튜브 계정에 동영상을 성공적으로 업로드하십시오.실제 결과: 할당량 초과됨

유튜브는 하루에 10,000개의 쿼리를 제공하는 것이 아니라 하루에 10,000개의 유닛을 제공한다. 어떤 작업을 하느냐에 따라 쿼리는 여러 개의 유닛이 될 수 있다.

반환된 각 리소스의 ID만 검색하는 간단한 읽기 작업에는 약 1단위의 비용이 든다.

쓰기 작업에는 약 50개의 비용이 든다.

동영상 업로드는 약 1600개의 비용이 든다.

89개 쿼리에 비디오 업로드 또는 쓰기 작업이 포함되어 있는 경우 해당 문제를 설명하십시오.

자세한 정보: https://developers.google.com/youtube/v3/getting-started#quota

손상된 Google 개발자 프로젝트 - 새 프로젝트 생성

나는 구글에 실망했다. 구글은 나에게 이 경우였다.

나는 같은 이슈를 가지고 있었고, "쿼터 초과" 응답 외에는 전혀 사용하지 않았다.나의 해결책은 새로운 프로젝트를 만드는 것이었다.시간이 지나면서 내부적으로 뭔가 달라져서 (적어도 내) 기존 프로젝트에 제대로 적용이 안 돼서 그런 것 같아...

나는 몇 가지 이유로 AWS 사용을 중단했고 구글 클라우드가 신선한 경험이 될 것이라고 생각했지만 이것은 구글이 기존 프로젝트를 죽이는 신제품만큼 나쁘게 취급하고 있다는 것을 보여준다.구글을 상대로 한 대 때려라.

https://github.com/googleapis/google-api-nodejs-client/issues/2263#issuecomment-741892605

참조URL: https://stackoverflow.com/questions/58469228/the-request-cannot-be-completed-because-you-have-exceeded-your-quota

반응형