title: Google Apps Script Error: We're sorry, a server error occurred. Please wait a bit and try again. (line 4, file "Code")
body: <p>I'm playing around with APIs in Google scripts. This is a code that worked for others but when running, I get an error:</p>
  
  <blockquote>
    <p>We're sorry, a server error occurred. Please wait a bit and try again</p>
  </blockquote>
  
  <p>(line 4, file "Code").</p>
  
  <p>Essentially, I downloaded a json file from Google Cloud containing my service account private keys, into my Google Drive. I linked the file that contains this information into the first line of the code. I know that the problem is in line 4 but I am not sure what could be causing the problem.</p>
  
  <pre><code>function getServiceAccountKeys() {
  
  var fileLink = "https://drive.google.com/open?id=ctrlq....";
  
  var fileId = fileLink.match(/[\w-]{25,}/)[0];
  
  var content = DriveApp.getFileById(fileId).getAs("application/json").getDataAsString();
  
  return JSON.parse(content);
  </code></pre>