Google 使用 UrlFetchApp 和 DocumentApp 时应用程序脚本授权失败

Google App Script Authorization fails when using UrlFetchApp and DocumentApp

我正在尝试为 Google 文档编写一个插件。仅使用 DriveApp 和 MailApp 时它工作正常,但当我尝试使用 UrlFetchApp 时,它就停止工作了。发生的事情是我弹出一个 OAuth 对话框说:

[App] needs your permission to access your data on Google

当我单击 "Review Permissions" 并选择我的 Google 帐户时,我会转到 google 500 错误页面,其中没有任何有用信息。

There was an error. Please try again later. That’s all we know.

我的项目属性显示了这些范围:

脚本需要 5 个 OAuth 范围:

https://www.googleapis.com/auth/documents
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/script.container.ui
https://www.googleapis.com/auth/script.external_request
https://www.googleapis.com/auth/script.send_mail

此脚本重现了问题:

function reproduceError() {
  var doc = DocumentApp.getActiveDocument();
  return UrlFetchApp.fetch("http://example.com"); 
}

当我从我的脚本中删除 UrlFetchApp 语句时,授权应用程序的提示消失,一切正常。

这似乎是 Google 方面的问题。 我使用 UrlFetchApp 在我的脚本中使用了相同的方法。 只能报错等待了