title: DriveApp Error: "We're sorry, a server error occurred. Please wait a bit and try again."
body: <p>Whenever I run the following function </p>
  
  <pre><code>    function getDatabases(){
        var files = DriveApp.getFilesByType(MimeType.GOOGLE_SHEETS);
        var amount = 0;
        while (files.hasNext()){
          if((files.next().getName()).indexOf("Database") &gt; -1){
            amount++;
          }
        }
        return amount;
      }
  
  </code></pre>
  
  <p>I get this error:</p>
  
  <p><a href="https://i.stack.imgur.com/iR6qX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iR6qX.png" alt="Error Message"></a></p>
  
  <p>This suddenly started about a month and a half ago. The same code was working earlier so I thought I reached a quota limit but that was not the case.</p>