Google apps script image.asInlineImage().getBlob()永远挂起

Google apps script image.asInlineImage().getBlob()永远挂起,google-apps-script,google-docs,google-apps-script-addon,Google Apps Script,Google Docs,Google Apps Script Addon,以下新问题出现在Google Docs附加脚本中,我相信在没有更改脚本或源文档的情况下 从今天下午开始,以下代码开始挂起在第行:var blob=sourceImage.asInlineImage().getBlob()。记录器正确记录图像宽度和高度,但从不记录“blobbed” var sourceImage = cell.getChild(m).getChild(0); var imageHeight = sourceImage.getHeight(); var imageWidth = s

以下新问题出现在Google Docs附加脚本中,我相信在没有更改脚本或源文档的情况下

从今天下午开始,以下代码开始挂起在第行:
var blob=sourceImage.asInlineImage().getBlob()
。记录器正确记录图像宽度和高度,但从不记录“blobbed”

var sourceImage = cell.getChild(m).getChild(0);
var imageHeight = sourceImage.getHeight();
var imageWidth = sourceImage.getWidth();
Logger.log('imageWidth:' + imageWidth + ', imageHeight:' + imageHeight);
var blob = sourceImage.asInlineImage().getBlob();
Logger.log('blobbed');
我试图用一个新的图像完全替换源图像,没有调整大小,没有剪辑。这会在日志中产生正确的新宽度和高度输出,但代码永远不会超过getBlob()行,不会记录任何异常(Stackdriver错误报告和Stackdriver日志都为空)。其他源文档也会出现同样的问题


源文档位于共享驱动器中。直到大约一周前,脚本还在运行。与权限有关吗?API有什么变化吗?你知道这是什么原因吗?

在准备一个最小的完整的可验证示例时,我发现问题出在
元素.copy()
中。脚本正在将元素从一个页面复制到另一个页面。代码首先复制,然后遍历副本的子级。显然,
element.copy()
复制所有子项,但如果其中一个子项包含图像,则不能对复制的图像使用getBlob()

而不是:

var element = templateBody.getChild(i).copy();
...
newParagraph = target.appendParagraph(element)
...
newTable = body.appendTable(element);
使用:

不使用element.copy(),现在可以对table类型的元素的子元素使用getBlob():

element.getChild(j).getCell(k).getChild(m).getChild(0).asInlineImage().getBlob();
目前尚不清楚为什么旧版本的代码一直工作到上周左右。

请添加一个新版本。
element.getChild(j).getCell(k).getChild(m).getChild(0).asInlineImage().getBlob();