0

I'm facing a strange error and I can't find a solution. I have a report that is generated daily by an application and that is stored on AmazonAWS. The application provides me the URL.

I have a Google App Script piece of code that get the file and stores on a TeamDrive to be read by Google BigQuery.

Facts:

  1. the request doesn't require any authentication: the URL works well if I execute it on my browser (Chrome) even using the private navigation, therefore it is not an authentication issue.
  2. the snippet worked well for about 3 months, on a daily basis. It is only in the last 3 days that has stopped working.

Now it seems that I cannot get that piece of code working. This is the snippet:

try {
  var res = UrlFetchApp.fetch(reportFile);
  retVal.fileContent = res.getContentText();
  retVal.success = true;
}
catch (ex) {
  retVal.success = false;
  retVal.errorMessage = "Can't download report file [" + ex + "]"
}

I have already tried to:

  • force the "get" method
  • force the "User-Agent" header
  • checked that all the parameters (X-Amz-Algorithm, X-Amz-Credential, X-Amz-Date, X-Amz-Expires, X-Amz-SignedHeaders, X-Amz-Signature) are correctly encoded

But no matter, I always get the "Unexpected Error" (even working with the the muteHttpExceptions option) and this force me to to do the download manually every time.

Is there any other possible solution I can use?

Thanks in advance.

Regards

  • Just in case you didn't notice, your question was closed as a duplicate of another question. Find the link at the top of your question. This is a internal bug=> star the issue=> expect Google to fix it. – TheMaster Dec 14 '20 at 11:52
  • I noticed but that question was totally unconnected to my request and that was explained in my text (I use to check answers before posting). Anyway, I found a note regarding a bug in the Google Forum and there are some workarounds explained there to solve this specific issue. Thanks!| – Alessandro A. Garbagnati Dec 15 '20 at 11:02
  • Isn't your question due to `But no matter, I always get the "Unexpected Error"`? Doesn't the duplicate banner say `This question already has answers here:`? If a question has a same answer as another question, it is considered a duplicate – TheMaster Dec 15 '20 at 11:03
  • Pity that the answer given in the other question is not the solution, since the problem is not the same of the other question. In fact the solution to this question has beern given in thye Google Bug Forum. Anyway it's ok. – Alessandro A. Garbagnati Dec 18 '20 at 12:03

0 Answers0