简体   繁体   English

例外:服务不可用:Google Doc Apps 脚本中的文档错误

[英]Exception: Service unavailable: Documents Error in Google Doc Apps Script

I have an odd issue with a Google Doc Apps Script.我对 Google Doc Apps 脚本有一个奇怪的问题。 It's been working for months without any issues.它已经工作了几个月,没有任何问题。 Then yesterday I get the Error Message: " Exception: Service unavailable: Documents " whenever I try to position an image blob (either from a URL Fetch or from getFileById).然后昨天我收到错误消息:“异常:服务不可用:文档”每当我尝试 position 图像 blob(来自 URL Fetch 或来自 getFileById)。 I simplified my code to this, and no matter what image I use, I always get the error.我将我的代码简化为这个,无论我使用什么图像,我总是得到错误。

function debugProc () {
  var rLlogoborderlessId = '1ZhOX_aneaAhM0XJV4oQHGfNPUzaVETgu';
  doc = DocumentApp.getActiveDocument();
  curBody = doc.getBody();
  var addlines = curBody.appendParagraph('');
  var imgpara = curBody.appendParagraph("");
  imgpara.setAlignment(DocumentApp.HorizontalAlignment.CENTER);
  var logoimage = DriveApp.getFileById(rLlogoborderlessId).getBlob();
  var addlineslogo = curBody.appendParagraph('');
  var k2nplogo = addlineslogo.addPositionedImage(logoimage);
  // Error:  Exception: Service unavailable: Documents
}

I tried multiple different computers and browsers.我尝试了多台不同的计算机和浏览器。 Nothing works.没有任何效果。 No workaround that I can find.没有我能找到的解决方法。 How can I resolve this?我该如何解决这个问题?

By reading your new comments I understand that the case isn't reproducible on new documents.通过阅读您的新评论,我了解该案例无法在新文件上重现。 The issue may have originated from a problem with your project or a bad configuration.该问题可能源于您的项目问题或配置错误。 To fix it, you only need to create a new Doc and copy all the data there.要修复它,您只需要创建一个新 Doc 并将所有数据复制到那里。 Feel free to leave a comment below if you need help with the migration.如果您在迁移方面需要帮助,请随时在下方发表评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM